Newline broken?

Ok, so for some odd reason (personally, i blame the crappy mplab compiler)
the newline
key has stopped working in the printf commands…

im confused at how this is even possible


any ideas?

I know it’s odd, and not right, but return is the character you’re looking for

printf("adaptive cruise setpoint: %d\r",;


o rly? wow. ok thanks.
i thought i remember the newline working before…
eh oh well… way to follow the C standard MPlab… </sarcasm>

It depends on what you’re using to view it. On Windows, line endings are
(A carriage return and a linefeed). Just a \r is incorrect, but I don’t complain if it works. Linux is just a
, nuff said. I think IFI Loader’s viewing thing wants a
(or at least an \r) and the Hyperterminal just wants an
… or maybe it was the other way around. It has nothing to do with c18 or mplab, it has to do with the client you’re using to view it. c18 doesn’t care what it’s sending. =)

As it turns out, \r has traditionally been the standard for Macintosh. I don’t know whether that has changed since Mac OS became more Unix-y. In any case, you’re right that this problem has far less to do with C18 than it does with the program you’re using to view your output.

Oh hm, you’re right, according to the wiki article I linked to it was used pre-OS X.

Personally I like just a
, even though
matches up with history. Prior to nice monitors, people used line printers. A
would feed paper. (It’s actually called a Line Feed.) \r moved the printer carriage back to the left. Thus a
positions it at the beginning of the next line, then we stopped using printers , and it was kept for compatibility reasons, and now no one should be using a line printers anymore… even though that’d be awesome.