Read and Write to TextFile with

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

Hi guys

If I have to read/write a text file which has the following format, what
would be the best way to read it? Should I readline method of the
streamreader to a string variable and parse it to the format below?

1 0.000016 7.999882 0.000000
2 1.000013 7.999875 0.000000

Many thanks

Sam
 
What *exactly* is the structure? Are the individual data items
separated by spaces? Tabs? Is each line delimited with a CR LF?
From the looks of it, using ReadLine would work to read the data in and
WriteLine to write it back out. You can use the various string
formatting commands to format the output string the way you want it.

Hope this helps
 
Chris

Thanks for the suggestions. The readline method works great when I read the
input data and display it in a text box.

Sam
 
Back
Top