Log in

View Full Version : printf and newlines


Jeff McCune
21-02-2004, 11:43
I'm using minicom in unix to read back the data from printf... How the heck do I get a new line so I can get a scrolling set of values rather than just a single line that always overwrites itself? I've tried all permutations of \r and \n together. Do I need to set my terminal to something specific, vt100 or ansi or something?

steven114
21-02-2004, 15:16
I'm using minicom in unix to read back the data from printf... How the heck do I get a new line so I can get a scrolling set of values rather than just a single line that always overwrites itself? I've tried all permutations of \r and \n together. Do I need to set my terminal to something specific, vt100 or ansi or something?

I used the settings 152000 baud (or something like that) and CRLF line returns successfully with my terminal, but I don't use minicom specifically.

Jeff McCune
21-02-2004, 17:44
I used the settings 152000 baud (or something like that) and CRLF line returns successfully with my terminal, but I don't use minicom specifically.

CRLF is \r\n from the perspective of printf(), right? Just making sure I'm bot being an idiot.

steven114
21-02-2004, 18:38
CRLF is \r\n from the perspective of printf(), right? Just making sure I'm bot being an idiot.

I had just \n in the printf calls, \r is unneeded (afaik)

Astronouth7303
21-02-2004, 20:01
I would guess that mplab uses ansi (ascii, 1 byte) letters. It's based on the compiler, since it translates strings to binary. that's also where \n stuff comes from.

gnormhurst
21-02-2004, 21:09
I'm using minicom in unix to read back the data from printf... How the heck do I get a new line so I can get a scrolling set of values rather than just a single line that always overwrites itself? I've tried all permutations of \r and \n together. Do I need to set my terminal to something specific, vt100 or ansi or something?

This probably won't help: I wanted to achieve the same thing (single, overwriting line) using the IFI loader's Terminal window. I tried \r, but it had the same result as \n.

I glanced at printf_lib.c and saw some stuff about \r, so there's hope. Have a look at printf_lib.c

-Norm