|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Newline broken?
Ok, so for some odd reason (personally, i blame the crappy mplab compiler)
the newline \n key has stopped working in the printf commands.. im confused at how this is even possible printf("test \n"); any ideas? |
|
#2
|
||||
|
||||
|
Re: Newline broken?
I know it's odd, and not right, but return is the character you're looking for
Code:
printf("adaptive cruise setpoint: %d\r",lvel.cruise);
|
|
#3
|
||||
|
||||
|
Re: Newline broken?
Quote:
i thought i remember the newline working before... eh oh well... way to follow the C standard MPlab.. </sarcasm> |
|
#4
|
||||
|
||||
|
Re: Newline broken?
It depends on what you're using to view it. On Windows, line endings are \r\n (A carriage return and a linefeed). Just a \r is incorrect, but I don't complain if it works. Linux is just a \n, nuff said. I think IFI Loader's viewing thing wants a \r\n (or at least an \r) and the Hyperterminal just wants an \n... 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. =)
http://en.wikipedia.org/wiki/End_of_line |
|
#5
|
||||
|
||||
|
Re: Newline broken?
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.
|
|
#6
|
||||
|
||||
|
Re: Newline broken?
Quote:
Personally I like just a \n, even though \r\n matches up with history. Prior to nice monitors, people used line printers. A \n would feed paper. (It's actually called a Line Feed.) \r moved the printer carriage back to the left. Thus a \r\n 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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Camera broken | Muffinman | Electrical | 2 | 01-02-2007 10:25 |
| Broken O/I | NumberQ | Robotics Education and Curriculum | 10 | 01-10-2004 16:06 |
| CD is broken. | Rickertsen2 | CD Forum Support | 62 | 26-10-2003 13:06 |
| Broken Gears? | archiver | 2001 | 2 | 24-06-2002 01:54 |
| Broken promises or BROKEN ROBOTS! | archiver | 1999 | 9 | 23-06-2002 22:18 |