This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with printf()

Hi,
when I use

printf("12345");
on the serial window #1 , I can only see
1234
so I wonder
(1)where is the character '5',
(2)why only "1234" is printed.
(3)Has '5' already been sent by serial port while not shown on the serial window #1
If I add '\n' to the pritf(), I mean to use
prinf("12345\n")
, then I could see the "12345" on the serial window #1 . Why?
(4)Does it also mean that the character '\n' is not printed!
(5)Does it mean that if we use printf() to print something, the last one character is always omitted?

Thanks for your help!

Parents
  • Have you tried this on a real target?

    I think this is to do with the way the simulator handles the serial window - the '\n' completes a line, and causes it to be displayed immediately; without the '\n', it has only a partial line - maybe it then waits til it has 4 characters to display?

Reply
  • Have you tried this on a real target?

    I think this is to do with the way the simulator handles the serial window - the '\n' completes a line, and causes it to be displayed immediately; without the '\n', it has only a partial line - maybe it then waits til it has 4 characters to display?

Children
No data