"bnob" <bn**@bluewin.ch> wrote in message
news:mn***********************@bluewin.ch...
I must read a txt file and when I found a line beginning with the word
"Backup", I must replace this line with "Save"
The read and the write must done into the same file!
I know how to read line after line a file (I use StreamReader), but how
can I write during I read the file ??
--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net
Check out the FileStream class Seek() method in the help.
<quote>
FileStream objects support random access to files using the Seek method.
Seek allows the read/write position to be moved to any position within the
file. This is done with byte offset reference point parameters. The byte
offset is relative to the seek reference point, which can be the beginning,
the current position, or the end of the underlying file, as represented by
the three properties of the SeekOrigin class.
Note Disk files always support random access. At the time of
construction, the CanSeek property value is set to true or false depending
on the underlying file type. Specifically, if the underlying file type is
FILE_TYPE_DISK, as defined in winbase.h, the CanSeek property value is true.
Otherwise, the CanSeek property value is false.
</quote>
--
Peter [MVP Visual Developer]
Jack of all trades, master of none.