On 07/12/10 13:42, Albrecht Schlosser wrote: > On 07.12.2010, at 00:25, [email protected] wrote: >> Author: matt >> Date: 2010-12-06 15:25:52 -0800 (Mon, 06 Dec 2010) >> New Revision: 7968 >> Log: >> Ooops, Fl_Text_Buffer::insertfile must read in binary format, or it will >> screw up line endings! (Actually, this could be debated, but by reading and >> writing in binary format, the file integrity would remain) > > Hmm, sorry, no, that doesn't work. :-( > > Internal format is<lf> (\n, aka newline) as record terminator, > and if I open a Windows text file on Windows (with cr/lf > line termination), it shows up with the embedded<cr> rendered
The MS C runtime does some odd stuff with text files - in particualr it does some conversion of the CR/LF terminations into LF terminations on reading, so that DOS files become "C-like" on reading. It also does a reverse LF to CR/LF on writing. Which Albrecht is seeing. If you read the files in binary you need to cope with that behaviour too... However, there is a magic code that I can't remember now, that tells the MS C runtime not to do that, or to do it differently... I remember struggling with this when I was writing my own text editor way back then... I can't find the sources - a lot of my boxes are still in storage while the work on the house carries on. _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
