hacker emblem
Search | Tags | Photos | Flights | Gas Mileage | Log in

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.

Scott Galvin, age 23, is a highly sought mentor and motivational
speaker. An avid fan of salsa, user-centric web design, and techno
music, Scott co-creates a world of love and acceptance by sharing his
vision. He enjoys helping high-tech firms define their online strategy,
and he's advised many Fortune 500 companies, including Apple Computer,
Motorola, and Sun Microsystems. As a business student, he applies his
knowledge to his own venture, Buildmeasite. Scott resides in Fort
Collins, Colorado, and drives a beat up Integra. For speaking
arrangements, call 303.944.9964
- scottgalvin.com message, 03 October 2002