I think it's because you switched platforms, specifically, line endings. If you created tfile.txt under DOS or Windows and then ran your program under Linux (i.e., Ubuntu), that's exactly what would happen.
Here's why. From http://en.wikipedia.org/wiki/Newline
DOS line endings are CR+LF, so that's what your file would contain. Then, reading it under Linux, which has LF line endings, the CR would be part of the previous line. With Macs, the opposite problem would occur: each line (except the first) would start with a LF.
* LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, etc.), BeOS, Amiga, RISC OS, and others
* CR+LF: DEC RT-11 and most other early non-Unix non-IBM OSes, CP/M, MP/M, MS-DOS, OS/2, Microsoft Windows
* CR: Commodore machines, Apple II family and Mac OS up to version 9