Well, i'm trying to read from a file, this is my file reader:
int readFile(char strArray[MAX][MAX]) {
FILE *infile;
infile = fopen("input.txt", "r");
int row = 0;
if(infile == NULL)
exit(0);
while(feof(infile) == 0) {
fgets(strArray[row], 100, infile);
row++;
}
fclose(infile);
return row;
}
and the "input.txt" file i was trying to read:
hello
goodbye
**an empty line***
the problem occurred when i left the last line as empty it will print out weird symbols, i have fixed it by removing the empty line but i am wondering if there is a way to leave the empty line but not print out weirds symbols, i have tried (C - Reading from a file issue with the last line) but it just freezed my compiler.