You should use
int main()
{
FILE *f;
f = fopen("1.input", "rt"); // in mode read only, text if(f == NULL)
{
printf("Non existing file \n");
return 0;
}
char myChar;
fscanf(f, "%c", &myChar); // read from file f one char and set its value in variable myChar
fclose(f); // close the IN file
FILE *fOut;
fOut = fopen("1.output", "wt"); // open file 1.output in write mode. All content will be erased
// if you want the content not erased, use "at" instead of "wt" (append text mode not write text mode"
if(fOut == NULL)
{
printf("Error opening output file\n");
return 0;
}
fprintf(fOut, "%c", myChar);
fclose(fOut);
return 1;
}
If you use a real C compiler, you should move all the var declaration at the beggining of the block
(immediatly after "main(){" ).
The codes for var types are:
%c - char
%d - integer
%x - hexadecimal
%f - float %s - character string
Calin