EOF in C++
Hi!
I have a problem with eof() function in C++. I have such file -
http://theval.eclub.lv/outCBC.txt as input file and I want to read all the characters from that file and put them on screen. I write it this way:
while (!infile.eof()) {
infile.get(c);
cout <<c;
}
But the problem is the character which is 8th from the end - the one right after the character `C` - C++ can't read the file further from this symbol. So it reads this `C` character and then it thinks it is the end of file already. But why?? How must I change the code to read all the file?
Edgars.
P.S. I think the ASCII code of this 8th character from the end is 26.
[717 byte] By [
TheVAL] at [2007-11-11 10:13:28]

# 6 Re: EOF in C++
I guess jonnin u mean a special case in some files, when their structure has two knowen restricted chars, one for defining the line end and one for fileend (like EOT in the bootstrab read section) , if u use to open one of those files in notepad , the lines aren't separeted with a return but a special char and u see all the lines are consecutive without any separations between them (as notepad can't display this special char) , and if u write to them when u don't know this restristed u may print one of them , it may be this endoffile and then whenever u read it by binary or any thing u will have this char as flag for the file end and can't continue reading .
but when u force it to read a special storage size , it hasen't any choice and it will continue the read process .
Amahdy at 2007-11-11 21:04:16 >
