Console output is not aligned

bash, c, embedded, embedded-linux, linux

Solution

Configure your terminal program to autolinefeed, so that it generates the `\r` internally whenever it receives a `\n`.

Problem

My embedded system has one background program which generates some output message to console. When it's not finished, the login program starts and prompt login string to same console as well. My question is, when the login prompt string comes out, the output message generated by the background program is not aligned like this: ``` Embedded System login: msg_line1... msg_line2... msg_line3... ``` The expected output should be: ``` Embedded System login: msg_line1... msg_line2... msg_line3... msg_line4... ``` Have no idea how to resolve the problem... Could anyone help? THX!!

Original source