reading a text file in C#

jspeirer

Member
Joined
Aug 7, 2003
Messages
8
I have a program that will accept any text file from a user. The program then accepts basic parameters about that file, such as record length, field positions, etc. At this point, it reads the records to do some reformatting. The files may not have any carriage control/line field characters, so I cant use the StreamReader ReadLine(). I have started to use the StreamReader Read(...) but that loads all the data into an array. For later processing, I need the data in a string. I can move the individual characters from the array to a string, but Im thinking there must be an easier way to to this. Any help?
 
If you want to just read the whole file you can use the ReadToEnd() method. Then searching the string that you got for specific things shouldnt be hard using the methods that the String Object provides. Do you have any more specific questions about this?
:)
 
Back
Top