By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,970 Members | 1,668 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,970 IT Pros & Developers. It's quick & easy.

How to wirte a char to a specified location in a txt file?

P: n/a
Hi,Everybody:
In EVB(or VB6), WriteFile() function starts writing data
to the file at the position indicated by the file pointer.
After the write operation has been completed, the file
pointer is adjusted by the number of bytes actually
written. But in VB.net which function can replace it? May
i use System.IO.FileStream.Seek locate the location and
then use System.IO.streamwriter to write char to txt file?

FS = New IO.FileStream(workDir & "\" & appInputFile,
IO.FileMode.Create, IO.FileAccess.Write)

sw = New IO.StreamWriter(FS)

FS.Seek((CurrentPoint - 1) *
FixedLen,IO.SeekOrigin.Current)

sw.Write(string)
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
* <an*******@discussions.microsoft.com> scripsit:
In EVB(or VB6), WriteFile() function starts writing data
to the file at the position indicated by the file pointer.
After the write operation has been completed, the file
pointer is adjusted by the number of bytes actually
written. But in VB.net which function can replace it? May
i use System.IO.FileStream.Seek locate the location and
then use System.IO.streamwriter to write char to txt file?

FS = New IO.FileStream(workDir & "\" & appInputFile,
IO.FileMode.Create, IO.FileAccess.Write)

sw = New IO.StreamWriter(FS)

FS.Seek((CurrentPoint - 1) *
FixedLen,IO.SeekOrigin.Current)

sw.Write(string)


Why not test it on your own?

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Improve your quoting style:
<http://learn.to/quote>
<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.