trying to read a text file in C, should be simple, but its proving to be hard 
the text file has multiple lines, which is possibly where im going wrong, keep getting Stream != NULL errors...
Does anyone have a quick bit of code to read a text file
edit: defined the size of my string, and all is well.
now it is interpreting spaces as line breaks

the text file has multiple lines, which is possibly where im going wrong, keep getting Stream != NULL errors...
Does anyone have a quick bit of code to read a text file

Code:
int ReadINI() {
char string;
FILE *fp;
fp = fopen("Countries.ini", "r");
if (!fp) {
printf("Error opening file");
return 0;
}
while (!feof(fp)) {
fscanf(fp,"%s",string);
printf("%s",string);
}
fclose(fp);
return 0;
}
edit: defined the size of my string, and all is well.
now it is interpreting spaces as line breaks

Last edited: