write to file with line breaker

Jun 11 2007 3:43 AM
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

Answers (1)