File stream looping

cfisher440

Well-known member
Joined
Oct 11, 2005
Messages
73
Programming Experience
1-3
This is what I am trying to do...

example
This is a line of text
This is a line of text
This is a line of text

read in each line of text and get the all the values from that line ("this", "is", "a", etc...).
read down to the next line and read in that line and get all the values and repeat this to the end of file.
There could be 8 lines of data or 1000 (it varies).
As the values are read in they need to be output to another text file.

Not sure why this is so hard for me. I have the logic but can't seem to output this into code.

Any ideas/questions/comments would be appreciated. :)
 
Last edited:
Use a Streamreader object. The Peek method returns -1 when there is no more data so you can use a Do or While loop. The ReadLine method reads a line from the file and returns a String object. The String.Split method can be used to seperate the words in a string into a String array.
 
Back
Top