Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Borland C++ 4.5compiler not recognizing sleep function,have dos.h

mattholomew (Programmer) (OP)
17 Aug 00 22:03
The Sleep(function), defined in dos.h, is not being recognized by my compiler(Borland C++ 4.5, and I have NO IDEA WHY.  Everytime I run it, it says, 'compiler error: 'sleep()' function not defined in prog5_2.' (I am doing the Windows Game Programming for Dummies, in case anyone cares.) In this book, the author has forgotten header files before, and he forgot dos.h, so I put it in when it didn't work without it, and it still doesn't work. I might try going into dos.h and hacking out the definition myself. (When the going gets tough, the tough try a hacksaw and blowtorch.) However, I have already tried this and failed the first time, and additionally, those things are so cryptic it gave me a major headache. This is the non-functioning section of code in my program...

      Sleep(10) ;

      The way to use the sleep function, so happily provided by the help contents, is: void sleep (unsigned seconds) ;

      I decided to try this before the hotline.  If anyone could help, I would appreciate it.
zBuilder (MIS)
17 Aug 00 22:48
You might want to look at the clock() function and create your own delay routine using it.


Kim_Christensen@telus.net
Home Page

hnd (Programmer)
18 Aug 00 7:39
Perhaps this is a problem of operating system. Sleep does not work with 16-bit Systems like Windows 3.11

hnd
hasso55@yahoo.com

Royt (IS/IT--Management)
18 Aug 00 15:18
mattholomew,

Isn't Sleep(10) sleep for 10 MILLIseconds

In which case it is probably working

Try
     Sleep(1000);     //  wait 1 second
You will definitely see the effect of this

Roy Thomas

 
marios (Programmer)
23 Sep 00 19:34
Either in VC++ in the Dos.h there is not a sleep or delay function.

Also the difference between sleep and delay is that
sleep has as argument number of seconds and the delay has
number of milliseconds

Marios Koumides
marios.koumides@wmich.edu
Guest (Visitor)
29 Oct 00 6:38
The old sleep() function is named _sleep() in dos.h file so use that one =)
wickedbeat (Programmer)
10 Nov 00 18:46
If dos.h is not recognized by the compiler then goto:
File-> New-> Project...->
choose "DOS STANDARD" from PLATFORM DROPDOWN BOX (you may have to type in the path of where you want to save your file manually).
Click "OK"
A window will pop up...
Click on "whatever_name.cpp" and hopefully...TAADAA!!!!!!!

 
hnd (Programmer)
11 Nov 00 6:49
I checked it on my Systems (Windows 3.11 and Windows NT)

the Result

Windows 3.11: Sleep is not found

Windows NT: it works.

The explanations can be found in the manual.




hnd
hasso55@yahoo.com
 
 
Guest (Visitor)
11 Nov 00 16:26
Are there any other common headers, or ones in Borland C++ 4.5, that has something similar as the delay function?
hnd (Programmer)
11 Nov 00 16:40
One method could be, use a timer and programm a Timer Event function with the Functionality you need.

hnd
hasso55@yahoo.com
 
 
Guest (Visitor)
27 Nov 00 10:55
I'm fairly new to C++ and Borland's compiler, and I had the same problem.  I did recently read in the on-line help (Borland Turbo C++ 4.5) that  dos.h  functions cannot be used in EasyWin.  If you are using EasyWin, you'll (and me) have to find an alternative.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close