Line ending convention?
Started: 2004-07-27 10:53:00
Submitted: 2004-07-27 10:59:29
Visibility: World-readable
I'm currently attempting to write code to interface over a serial port with an embedded system my employer purchased to use in an upcoming project. (I'm not sure I can be much more vague than this if I tried. Many of my loyal readers whom I've spoken to in meatspace may have some idea what this project is.) This device takes several simple commands and returns some simple output. For some reason that I haven't yet determined, the strings it returns print a line feed first, then a carriage return, which is a line-ending convention I've never seen before.
DOS-based and DOS-derived machines (such as modern Windows systems) use a carriage return (ASCII 0x0d) followed by a line feed (ASCII 0x0a) to terminate a line of text. Unix systems use a bare line feed, and Mac systems (prior to OS X; I don't know what X does) use a bare carriage return. My office-mate is determined to believe that the bizarre LF/CR combination was a conscious design decision to interface with some ancient piece of hardware that was used to develop the system. I'm more inclined to believe that it was an ignorant decision on the part of the original developers who didn't know what DOS' line-ending convention was.