Solved

"fgets" function fails

Posted on 1997-11-25
1
296 Views
Last Modified: 2006-11-17
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.
0
Comment
Question by:mskohut
1 Comment
 
LVL 3

Accepted Solution

by:
rmichels earned 100 total points
ID: 1256406
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?
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question