Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

"fgets" function fails

Posted on 1997-11-25
1
Medium Priority
?
311 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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
Suggested Courses

782 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