I've never really used C before but I have to read a text file line by line.
Problem is that if its a blank line it seems to read the previous line again. How do I avoid this?
This is my code at the moment:
Thanks.
EDIT: It was another function at fault. Thanks for looking
Problem is that if its a blank line it seems to read the previous line again. How do I avoid this?
This is my code at the moment:
Code:
char line[100];
FILE* fp = fopen ("filepath.extenstion", "r");
int i = 1;
while (fgets (line, sizeof (line), fp))
{
function_with_line_input (line);
i++;
}
fclose (fp);
Thanks.
EDIT: It was another function at fault. Thanks for looking
Last edited: