I Need A Code!!!!

This is a discussion on I Need A Code!!!! within the C++ Programming forums, part of the General Programming Boards category; WHATS THE CODE TO WAIT (PAUSE) FOR A CERTIN AMOUT OF SECONDS ED. 5 SECONDS...

  1. #1
    Registered User Prodigy's Avatar
    Join Date
    May 2002
    Posts
    25

    I Need A Code!!!!

    WHATS THE CODE TO WAIT (PAUSE) FOR A CERTIN AMOUT OF SECONDS ED. 5 SECONDS
    And the cows moo...
    AIM:ProdigyCpp
    E-Mail:ProdigyMan911@aol.com
    If you like my avatar plz dont copy it go to:
    http://www.dragid.com/

  2. #2
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    include dos.h
    delay(5000) //5 seconds
    or if that doesn't work
    include windows.h
    sleep(5000)//5 seconds
    and i see you got another animated avatar

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    59

    include

    For portability/compatibility you might want to include the unistd.h file instead of windows.h or dos.h.

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    99

    :(

    None of them seem to work for me, I'm using Dev C++. Windows 98

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >For portability/compatibility you might want to include the
    >unistd.h file instead of windows.h or dos.h.
    No, that won't work too well since unistd.h is only compatible with POSIX platforms and won't work on DOS/Windows systems. I've always been of the opinion that if you can't easily do it portably, do it yourself:
    Code:
    #include <ctime>
    void mesleep ( long m )
    {
      clock_t limit, 
              c = clock();
      limit = c + m;
      while ( limit > c )
        c = clock();
    }
    Or you could use conditional compilation to include the appropriate headers according to the platform the program is compiled on.

    -Prelude
    My best code is written with the delete key.

  6. #6
    Registered User Sekti's Avatar
    Join Date
    Feb 2002
    Posts
    163

    for windows

    Code:
    #include <iostream.h>
    #include <windows.h>
    
    int main()
    {
    cout<<"Pauseing for 5 seconds"<<endl;
    Sleep(5000);  /* Notice capital 'S' in Sleep */
    cout<<"Done pauseing"<<endl;
    return 0;
    }
    But that only works on windows...
    +++
    ++
    + Sekti
    ++
    +++

  7. #7
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    >None of them seem to work for me, I'm using Dev C++. Windows 98

    Have you included windows.h?
    Are you using a small s instead of a big S (Like it should be) in Sleep()?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 05:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21