Topic: Question concerning streams
Author: graf@igd.fhg.de (Frank Graf)
Date: 1995/07/11 Raw View
Hello
I problem with the streams. Ihe question is, how can I read again in a
stream once I have read over the end of file. Actually I do not want
to read behind the EOF, I want to use seekg() to go back to a known
location in the stream. But this does not work since there is an
error. So I tried the following code but it also failed
istream is;
<do the reading stuff>
if(is.eof())
clear(is.ios::eofbit);
Can anyone tell me how to get the stream back into a state that I can
read again, without having to close and open the stream again.
While we are on the subjects of streams, just a second question.
Can I open a file stream for reading an writing and then remove part
of the contents of the file by overwriting the contents of the stream.
I know this works if one wants to add something, but is there a
problem if the stream becomes smaller.
Like is it sufficent to write an EOF char at a new position?
Thanks
Frank
--
,,,
(o o)
---------------------------oOO--(_)--OOo----------------------------------
Frank Graf |
Technische Hochschule Darmstadt | Telefon +6151 - 155 - 184
Fachgebiet GRIS | Fax +6151 - 155 - 199
Wilhelminenstr 7 |
64283 Darmstadt | email graf@igd.fhg.de
Germany |