[quoted text, click to view] hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP]) wrote in message news:<c7acpv$1gt0a$2@ID-208219.news.uni-berlin.de>...
> * barbara_dave@yahoo.com (barbara) scripsit:
> > Yes. I did look at the Help file, but I still can't understand it.
> > What I need is:
> >
> > I open a text file and write something into the file, and I need to
> > set a file pointer before I close it. When I second time open the
> > file, I need to write a string at the first time pointer position.
> > Could someone give me some sample code?
>
> The file pointer will be lost when closing the file. You will have to
> store the position somewhere else.
Even I don't close the file, I still can't get the position. My code
is in the following:
dim myFileStream As FileStream
dim myFileWriter As StreamWriter
dim Location as long
myFileWriter.writeline("Line1")
myFileWriter.write("Line2") 'I need to add a string in here later
Location = myFileWriter.BaseStream.seek(0, seekorigin.current)
muFileWriter.write(controlchars.crlf)
myFileWriter.writeline("Line3")
.....
'Now I want to go back to the end of Line2 to append " a string"
myFileWriter.basestream.seek(Location, seekorigin.begin)
myFileWriter.write(" a string")
For some reasons, Location value always is 0, and " a string" always
added to the end of the file instead of Line2. Where I am wrong???
Please give me some instructions!!!