Read and Write to TextFile with

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
 
C

Chris Dunaway

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
 
S

Sam

Chris

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

Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top