• C

"fgets" function fails

I open an ASCII file with some control charactes in it (it is a printer output) with the function "fopen" for reading. Then, I read the lines of the file with the function "fgets". My problem is: As soon as a line contains the character 0x1A, the following call of "fgets" returns NULL, even if there are more lines to read.
Who is Participating?
rmichelsConnect With a Mentor Commented:
Code 1A (ctrl-Z) is an end of file character.  When dealing with text streams you cannot read past this character.  Can you open the file in binary mode?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.