I am running Mac OS X Ver. 10.7.5 and when I try to compile this simple program I get this error when I try to fprint to the file:
implicit declaration of function 'printf' is invalid in C99
implicit declaration of function 'printf' is invalid in C99
Code:
#include <stdio.h>
int main()
{
FILE *myfile;
myfile = fopen("alive.txt", "w");
if(!myfile)
{
puts("Some kind of file error!");
return(1);
}
fprint(myfile, "I created a file! It's alive!\n");
fclose(myfile);
return 0;
}
Comment