I understand from C manpage that using fgets()
, reading stops after an EOF
or a newline. i have a program that reads from file(with multiple lines) and reading stop at the end of new line.
Is there a way to forcefgets()
to ignore newlines and read till EOF
?
while(fgets(str,1000, file))
{
// i do stuffs with str here
}
Is there a way to force
fgets()
to ignore newlines and read tillEOF
?
No, you can't because fgets()
is implemented in such a way that the parsing will stops if end-of-file occurs or a newline character is found. May you can consider using other file i/o function like fread()
.