Just Me,
I'd like the file to be a .txt file
If you want a .txt file, then you need (should) use a TextWriter,
specifically StreamWriter.
I think it would be simple to concat the strings with commas seperators
before write, and then use split to separate then after read. Agree?
Rather then concat the strings, I normally write the three strings & the
seperators to the StreamWriter. (eliminating any potential for temporary
strings cluttering the GC)...
Something like:
Dim writer As StreamWriter
writer.Write(string1)
writer.Write(","c)
writer.Write(integer1)
writer.Write(","c)
writer.Write(double1)
writer.WriteLine()
Of course the above may be in a loop, especially if the variables are coming
from a DataTable or any object via reflection...
Alternatively I've used the format parameter on TextWriter.WriteLine to
format the variables, something like:
Const format As String = "{0}, {1}, {2}"
writer.WriteLine(format, string1, integer1, double1)
The format parameter is more useful for internationalization & including
other text in the line...
before write, and then use split to separate then after read. Agree?
I normally use String.Split to read the file, however you can have problems
when the fields being written include the field delimiter or quoted
strings... I have not worked out a RegEx to use with RegEx.Split to more
intelligently split the fields...
Hope this helps
Jay
Just Me said:
I don't know.
Actually in this instance I need to write/read many records of three
strings.
I'd like the file to be a .txt file
I think it would be simple to concat the strings with commas seperators
before write, and then use split to separate then after read. Agree?
If that is the approach how do I use streams to read/write?
Thanks
<<snip>>