I am looking for a way to seek to a beginning of stdout. The reason I want to do that is because I am writing a program and i want to constantly display a status(idle, working, done) while writing other output on stdout.
I tried using fseek
and lseek
but with no success. I also tried using \r
and \b
in printf
when printing but that also didn't work for me.
For example, the output i want to have would be something like this:
[Idle] Waiting for file...
And when the file is received i want it to change the output to:
[Working] Getting contents of the file...
And when that job is complete to change it to:
[Idle] Waiting for file...
[Done] Saved contents from a file...
And when the next file appears change the status to Working and afterwards change it back to Idle and print out a Done message.
Thanks in advance