Hello there!
I had same problem, too a few time ago. After searching and doing some tests, I realized the following: Linux handles newline character '\n' as it should (i.e., it forces a newline), but Windows uses a '\n\r' newline+carriage return pair (don't know about the order, though) to force newline. However, if you use Wordpad to open your .txt file, it should handle '\n' correctly. That is, it is NOT a programming bug or something related to the compiler, but it's Windows that handles the characters differently.
Cheers