Re: [Dev-C++] file.read() dosn't read all it should read
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Alfred P. R. <al...@ya...> - 2005-02-18 20:02:06
|
The other thing is file mode, text vs. binary. If you open the file in text mode, and you get an EOF character, the read will terminate, however you can read lines of text. In binary mode, EOF is just another character. I forget offhand which is the default open mode. The sites of pertinence are Microsoft's header library documentation: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vclrfcpluspluslibraryoverview.asp and C++ I/O: http://www.cppreference.com/cppio/ --- Gerson Lara <ja...@ya...> wrote: <snip> > So , I can only say tha the trouble seems to be with the opening of > the file. > In my few expreriences, if you read a file to the end, I mean, if you > read "all the file" once, you'll not be able to read again, even > moving the read pointer ( i.e. seekg(0, ios::beg ), unless you close > the file and re-open it. Is that happening to you? I recomend to read > all the file, and close it, so if you need it later, you have it in > RAM, you can modify the contens of the file in RAM and then use > ofstream to replace the contens of the file to actualize it. > > Im a very satisfied user of fstream, i can even read binary files > with it, like bitmap files or .mp3 files. so I can tell fstream is > powerful. So if you can't resolve, tell me more about your code. <snip> ===== Alfred P. Reaud |