I'm currently working on some code but I'm stuck. I have a text file in which the name and each name are on a new line I have read these names in a list, but I want to be able to read each letter of each line (name in the text file). If someone can help me then I would appreciate it!
This code will load the file c: \ Temp \ test-1.txt in a StreamReader, Each line reads until it hits the EOF, and prints each letter on a new line in the console. Modify as necessary.
Note that if your file is stored on a very long line (and actually a large file), then you have to do some extra care here to avoid memory exceptions.
string line; (Using the StreamReader Reader = New Stream Reader ("C: \\ temp \\ test-1.txt")) (reader.Peek ()> gt1) {line = reader.ReadLine (); Foreach (Four C in line) {Console.WriteLine (C); }}}
No comments:
Post a Comment