What does the sleep function do?
can someone explain what the sleep function does.in this case here!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include <windows.h>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int counter=0;
ofstream myfile;
myfile.open("basic.txt");
while(true)
{
if(GetAsyncKeyState(VK_ESCAPE))
{
counter++;
myfile <<"Escape : " <<counter;
cout<<"Button pressed !"<<endl;
}
Sleep(100);
}
return 0;
}
|
does the sleep() function time in milli seconds?
Did you not check out Athar's link?
From the MSDN entry
1 2 3
|
VOID WINAPI Sleep(
__in DWORD dwMilliseconds
);
|
im just making sure...thanks o yea i would appreciate more help heres my code for some reason it wont compile im sorry im a noobie.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#include <windows.h>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int counter=0;
ofstream myfile;
myfile.open("please.txt");
while(true)
{
if(GetAsyncKeyState(VK_ESCAPE))
{
counter++;
myfile <<"Escape : " <<counter;
cout<<"Button pressed !"<<endl;
if(GetAsyncKeyState(VK_ENTER))
{
myfile <<"." << counter;
}
}
Sleep(100);
}
return 0;
}
|
Error message? Line?
ok,
in function 'int main()':
VK_ENTER' undeclared (first use this function)
VK_ENTER should be VK_RETURN
Topic archived. No new replies allowed.