Sleep on Bloodshed Dev C++

This is a discussion on Sleep on Bloodshed Dev C++ within the C++ Programming forums, part of the General Programming Boards category; Hey Thanks, I had a lower case sleep instead of Sleep. I am trying to make my program wait a ...

  1. #1
    Registered User BigSter's Avatar
    Join Date
    Nov 2001
    Posts
    47

    Cool Sleep on Bloodshed Dev C++

    Hey Thanks,
    I had a lower case sleep instead of Sleep.

    I am trying to make my program wait a few seconds and then proceed on. I am using Bloodshed Dev C++ IDE on Windows ME. This is what I have so far, but I get an "Implicit declaration of function 'int sleep(...)' "
    Thanks

    #include <iostream.h>
    #include <stdlib.h>
    #include <dos.h>
    int main()
    {
    . . . . . . . .
    sleep(2);
    . . . . . . . .
    }
    Last edited by BigSter; 11-15-2001 at 06:48 PM.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    375
    There is no sleep function, but it isn't hard to make one:

    Code:
    #include <stdio.h>
    #include <time.h>
    
    time_t now, later;
    
    void sleep(int delay)
    {
     now=time(NULL);
     later=now+delay;
     while(now<=later)now=time(NULL);
    }
    
    int main(void)
    {
     printf("Taking a few second pause.\n\n");
     sleep(4);   
     printf("\aPause done!\n\n");
     printf("Press Enter to exit.");
     getchar();
     return 0;
    }
    Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    61
    There actually is a sleep function you just have to include windows.h to use it.
    Code:
    #include <windows.h>
    
    int main()
    {
        Sleep(1000); // this will make the program pause for 1000 milliseconds
    
        return 0;
    }

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    375
    Oh yeah.
    Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bloodshed Dev Stops Compiling
    By bengreenwood in forum C++ Programming
    Replies: 4
    Last Post: 11-11-2007, 02:25 PM
  2. bloodshed dev c++ help
    By rocketmanx in forum Game Programming
    Replies: 4
    Last Post: 07-28-2004, 02:57 AM
  3. Bloodshed Dev c++
    By Zabur in forum C++ Programming
    Replies: 2
    Last Post: 04-12-2003, 11:27 PM
  4. Wait on Bloodshed Dev C++
    By BigSter in forum C++ Programming
    Replies: 1
    Last Post: 11-14-2001, 02:46 AM
  5. Tutorial about Bloodshed Dev!
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 11-13-2001, 06:42 PM

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