In VB 6, you could always use LOF() to find the length of the file you were writing; however, in VB.NET or C# is not as obvious.
Dim s As StreamWriter = New StreamWriter(filename)
.
.
.
s.BaseStream.Flush()
Dim offsetPosition as Long = s.BaseStream.Length
One thing to note, you will have to do the Flush before using the length property or you will not get accurate results. You can also set the AutoFlush property on the StreamWriter object.
For more info, see:
http://www.thescripts.com/forum/thread266352.html
No comments:
Post a Comment