I have a question. Still trying to understand.
I am using borland c++ vr 4.5. I am working on a project
that usees the sleep function 4.5 does not support this
function. Is there somewhere i can find a win16 version
that would work in this program.
tnx
ron hathcock

Recommended Answers

All 8 Replies

Are you including stdlib.h in your source? or you could try using the delay() function...

win16 version? what sort of comp are you using?

Sleep(time_in_ms) is a Win32-API function and you might want to include windows.h

Make sure you are using Sleep() and not sleep().

Borland 4.5 supports the delay function IIRC. Include <dos.h> and pass it the number of milliseconds you want to pause:

#include <iostream.h>
#include <dos.h>

int main()
{
  cout<<"Test 1\n";
  delay(2000);     // Two second pause
  cout<<"Test 2\n";

  return 0;
}

Sleep(time_in_ms) is a Win32-API function and you might want to include windows.h

Make sure you are using Sleep() and not sleep().

I donot have windows.h installed, can you use a win 32 api
with a win 31 application
tnx ron hathcock

Are you including stdlib.h in your source? or you could try using the delay() function...

win16 version? what sort of comp are you using?

I am using a compaq armada 1700 laptop the sdlib does not contain delay function
tnx
ron hathcock

Borland 4.5 supports the delay function IIRC. Include <dos.h> and pass it the number of milliseconds you want to pause:

#include <iostream.h>
#include <dos.h>

int main()
{
  cout<<"Test 1\n";
  delay(2000);     // Two second pause
  cout<<"Test 2\n";

  return 0;
}

could you expain IIrc what does this mean and delay is not included in the dos header.
tnx
ron hathcock

>could you expain IIrc what does this mean
IIRC = If I Recall Correctly. It basically means that I don't remember for sure because your compiler is old as dirt and I have bad memory.

>and delay is not included in the dos header
Search your headers for any occurance of sleep, delay, or pause in any way, shape or form. Or you could read the documentation like a normal developer instead of asking people who (if they even used it!) discarded your compiler for better alternatives many years ago.

It is in the free Borland C++ Version 5.5 and even the very old Turbo C Version 3.1 has delay() in the dos.h header. You might have to tell it, that you don't compile for a windows program with "#undef Windows" or something like that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.