I'm trying to scan the contents of a file "phrases.txt" which at the moment is a single character 'g' and I'm trying to put that in the variable c. The problem is that this program below returns a blank character and I'm not sure why. I've even tried changing the name of the file to an invalid file name and it doesn't make a difference. I'm using the latest Dev-cpp to compile and run this if that helps. Does anyone know what I'm doing wrong? Thanks
Code:
#include <stdio.h>
#include <conio.h>
int main()
{
char c[10];
FILE * file = fopen("phrases.txt","r");
fscanf(file,"%c",c);
printf("%c",c);
fclose(file);
getch();
return 0;
}