SLEEEP! [FIXED]

Started by
6 comments, last by Roboguy 17 years, 12 months ago
Hello, I was looking up on "sleep". I wanted to make a delayed message, but when I use sleep, it says theres an error. Please help me.

#include <string>
#include <iostream>
using namespace std;

int main()
{
    cout << "HELLO ";
    sleep(2000);
    cout << "WORLD\n\n";
    
    system("pause");
    return 0;
}




Advertisement
Could you be more specific? Is it a compiler error? Is it a runtime error? What does the error say?
Sleep() is a Win32 API function. Thus, all you gotta do is include windows.h too like this...

#include <windows.h>
#include <windows.h>

And I believe it's Sleep();
I teleported home one night; With Ron and Sid and Meg; Ron stole Meggie's heart away; And I got Sydney's leg. <> I'm blogging, emo style
Remember that the Windows version has a capital S ;)
it isn't sleep(2000) it is Sleep(2000)... and be sure to include windows.h like nullsmind said.
Thanx everyone. It worked :)
Sleep is a non-standard Windows-only function. sleep is a bit more portable. sleep is in <unistd.h>.

This topic is closed to new replies.

Advertisement