Click here to Skip to main content
15,902,447 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: fputc or fgetc returning odd results [modified] Pin
Rajkumar R9-May-08 3:38
Rajkumar R9-May-08 3:38 
GeneralRe: fputc or fgetc returning odd results Pin
Klempie9-May-08 4:15
Klempie9-May-08 4:15 
GeneralRe: fputc or fgetc returning odd results Pin
Rajkumar R9-May-08 4:21
Rajkumar R9-May-08 4:21 
GeneralRe: fputc or fgetc returning odd results Pin
Klempie9-May-08 4:28
Klempie9-May-08 4:28 
AnswerRe: fputc or fgetc returning odd results Pin
Klempie9-May-08 4:48
Klempie9-May-08 4:48 
GeneralRe: fputc or fgetc returning odd results Pin
Rajkumar R9-May-08 5:05
Rajkumar R9-May-08 5:05 
GeneralRe: fputc or fgetc returning odd results Pin
Rajkumar R9-May-08 4:56
Rajkumar R9-May-08 4:56 
AnswerRe: fputc or fgetc returning odd results Pin
Klempie9-May-08 5:06
Klempie9-May-08 5:06 
No Raj, it's cool. It's working now. I know what the problem was. I opened it to read it as a text file. The EOF character for text streams is 0x1A which equals 26 (I'm guessing this applies to Windows systems only). So obviously when the stream reads 0x1A it returns -1 as EOF to the application. The key is to fopen with "rb" and not only "r". Obviously then you are reliant on yourself to make sure your app doesn't read over the end of your file. In my application EOF is irrelevant because I use dimensions to keep track of where I am. That's why it doesn't appear in my code. In fact, for binary files it would appear that EOF is only useful for binary data which does not include the EOF value. Anyway, it is working now, so thank you for all your help.
GeneralRe: fputc or fgetc returning odd results Pin
Rajkumar R9-May-08 5:10
Rajkumar R9-May-08 5:10 
AnswerRe: fputc or fgetc returning odd results Pin
toxcct9-May-08 3:06
toxcct9-May-08 3:06 
GeneralRe: fputc or fgetc returning odd results Pin
Klempie9-May-08 3:38
Klempie9-May-08 3:38 
GeneralRe: fputc or fgetc returning odd results Pin
toxcct9-May-08 3:45
toxcct9-May-08 3:45 
GeneralRe: fputc or fgetc returning odd results Pin
Klempie9-May-08 3:47
Klempie9-May-08 3:47 
GeneralRe: fputc or fgetc returning odd results Pin
toxcct9-May-08 3:50
toxcct9-May-08 3:50 
GeneralRe: fputc or fgetc returning odd results Pin
Klempie9-May-08 3:53
Klempie9-May-08 3:53 
GeneralRe: fputc or fgetc returning odd results Pin
Rajkumar R9-May-08 4:27
Rajkumar R9-May-08 4:27 
GeneralRe: fputc or fgetc returning odd results Pin
CPallini9-May-08 5:01
mveCPallini9-May-08 5:01 
GeneralRe: fputc or fgetc returning odd results Pin
Klempie9-May-08 5:06
Klempie9-May-08 5:06 
QuestionMemory allocation help. Pin
chandu0049-May-08 1:06
chandu0049-May-08 1:06 
AnswerRe: Memory allocation help. Pin
toxcct9-May-08 1:11
toxcct9-May-08 1:11 
GeneralRe: Memory allocation help. Pin
Michael Schubert9-May-08 1:17
Michael Schubert9-May-08 1:17 
GeneralRe: Memory allocation help. Pin
chandu0049-May-08 1:24
chandu0049-May-08 1:24 
GeneralRe: Memory allocation help. Pin
JudyL_MD9-May-08 1:55
JudyL_MD9-May-08 1:55 
GeneralRe: Memory allocation help. Pin
chandu0049-May-08 2:12
chandu0049-May-08 2:12 
GeneralRe: Memory allocation help. Pin
JudyL_MD9-May-08 3:10
JudyL_MD9-May-08 3:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.