Iterating over a txt file in a good old C.
Hey folks, I know some core theory and the very basics of C, but I cant get my simple program to work, I must have forgot something:
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *ftr = fopen("_TEST.txt", "r");
if (ftr == NULL) { printf("Can't open the file.\n");return 1;};
char c;
while ((c=fgetc(ftr) != EOF))
{
fscanf(ftr, "%s", &c);
printf("%c", c);
}
return 0;
}
I have tried some other output methods but It never prints entire file as I wanted to, in example this one prints nothing.