printf \n only sending LF

20 Oct 2010

It looks like printf "Hello World!\n" is only appending a Line Feed character (0x0A) and not appending a Carriage Return as well (0x0D) as expected.  Has anyone else noticed this?

20 Oct 2010

Yes that's right:)

I believe it's a normal behavior of the standard library (on unix compatible environment). If you need to send both 0x0D and 0x0A, do it by "Hello World\r\n".

20 Oct 2010

Ah.  I was using HyperTerminal which doesn't automatically add the 0x0D as the O/S does as you say.  \r\n works - thanks!

21 Oct 2010

Terminal apps doesn't do anything for the strings. If you use TeraTerm, you can set the application that handles the 0x0A instead of 0x0D.

But it may be nice to have "\r\n" for string outputs for people who are using the terminal with default setting.

Let's enjoy mbed!