See my code
char t[]= "{\n abcdeffgjejgjergnjkengkknkn \n";
printf("%s",t);
char t1[]= "{ abcdeffgjejgjergnjkengkknkn \n aaffdefa";
printf("%s",t1);
Actual Output:
{
{ abcdeffgjejgjergnjkengkknkn
Expected output:
{
abcdeffgjejgjergnjkengkknkn
{ abcdeffgjejgjergnjkengkknkn
aaffdefa
Can any one help me why string is not getting print after \n (LF)?
Compiler - arm-none-eabi
Library header - Newlib
IDE: MCUExpresso
By default
stdout(whereprintfwrites) is line buffered. That means the output buffer is flushed (actually written) either when it's full or when you print a newline.That's why the second part of the output isn't printed, because it's not enough to fill the buffer and you have no newline to flush the buffer.
You can flush explicitly yourself by calling
fflush: