Write to file with line breaker
When I write to file using:
StreamWriter sw=new StreamWriter("blah.txt");
sw.WriteLine(toFile);
where toFile is the variable holding strings and there are '\n' inside to make line breaker. On the console, it has the correct format. But when I see the generated file "blah.txt". There is no line breaker. All strings go together.
When I use code to read back:
StreamReader sr=new StreamReader("blah.txt");
rl=sr.ReadLine();
it works well as '\n' does seperate the strings. My question is why the generated file doesn't show the correct format. Is this the txt file's problem or is this C#'s problem?
Thanks
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

AlanRank #669 · 3.6K reputationPosted Jun 11, 2007, 2:30 AM EDT
It will still display properly on the console which recognizes either.