![]() |
|
#1
|
|||
|
|||
using fstream::fstream , question about error statusHi,,, I have been fooling around with using the fstream class to read AND write to a file.
I was having a problem writing the the file a second time after a previous write and readback. I searched and learned about checking error status and tracked down the problem for which I found two solutions. whoop... But the two solutions leave me with the question of which is the better or more proper to get in the habit of using: CPP / C++ / C Code:
CPP / C++ / C Code:
Last edited by Howard_L : 27-Aug-2008 at 10:07.
|
|
#2
|
|||
|
|||
Re: using fstream::fstream , question about error statusQuote:
But, seriously, if you have been cruising around in the file, reading and/or writing, and you just want to get to the end of the file to write some new stuff without reading everything (and throwing it away), why not just do something like the following? CPP / C++ / C Code:
Read up on seekg() and seekp() Regards, Dave |
|
#3
|
|||
|
|||
Re: using fstream::fstream , question about error statusI guess that's an 'it doesn't matter'?
I understand seekg() and seekp() usage and use it some in the program above. I suppose I was just wondering if it was undesireable to read to EOF and get that error bit. Thanks |
Recent GIDBlog
Gang violence and the drug culture by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Please, This is Difficult question try for me! | bcompt143 | C++ Forum | 4 | 24-Aug-2008 09:14 |
| Question about locking surfaces to directly access pixels, SDL. | george89 | C++ Forum | 0 | 18-Jun-2006 21:16 |
| question on sorting items is not clear...plz help me | gvsivannarayana | C Programming Language | 0 | 28-Mar-2006 00:26 |
| Question about sprintf() | shvalb | C Programming Language | 1 | 23-Feb-2005 04:28 |
| question of practice | magiccreative | C++ Forum | 1 | 06-Feb-2004 07:17 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The