Reputation: 1
How to read character by character in line from text file?
Upvotes: 0
Views: 863
Reputation: 74116
Use the StraemReader class. It has a Read() method that reads the next character from the input stream and advances the character position by one character. (Overrides TextReader.Read().)
For example:
using (StreamReader sr = new StreamReader(path))
{
while (sr.Peek() >= 0)
{
char c = (char)sr.Read();
}
}
Upvotes: 1