Hey,
I'm writing a program that takes input from a file called index.txt. I want to be able to discard blank lines. This is what I have:
This works when I have many blank lines in the document, but it doesn't catch trailing blank lines.Code:while (!feof(fp_fileNamesCheck)) { char buf[256]; fgets(buf, 255, fp_fileNamesCheck); if (strlen(buf) > 1) newNamesCount++; }
Ex, it catches
|File1
|File2
|
|
|
but doesn't catch
|File1
|File2
|
Any help would be appreciated. Thanks.