Thread: delay in a c++ file (2)

  1. #1
    Unregistered
    Guest

    delay in a c++ file (2)

    i tried Sleep(x); but that didn't seem to work. At the top i use

    #include <iostream.h> in stead of #include <windows.h> will that make a difference?

  2. #2
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    it makes a very very big difference, if you dont include windows.h it wont work - Sleep is defined in windows.h - so you must include it for it to work
    Monday - what a way to spend a seventh of your life

  3. #3
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    sleep function is in dos.h
    -

  4. #4
    Registered User rmullen3's Avatar
    Join Date
    Nov 2001
    Posts
    330
    I just write my own.

    Code:
    inline void sleep_f (long time)
    {
          for (int I = 0; I != (time << 2); ++I) ;
    }

  5. #5
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    the Sleep(x) function is in windows.h
    i am right
    i use this in a lot of applications
    edit--

    however if you wish to keep your code portable and not OS specific it is a good idea to code your own as above
    just create a null loop - stick it in a header and call as you wish
    Monday - what a way to spend a seventh of your life

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  3. file processing updating record error
    By uuser in forum C Programming
    Replies: 2
    Last Post: 04-27-2003, 12:13 AM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM