How to overwrite/change characters in the same field with C.
Hi
sorry if the question title seems vague but this is part of the problem I'm having;i.e putting the right question into google to get the right answer.Let me try to explain .. Basically I am curious as to how programs,such a transcode or avimux etc manage to print to the standard output continually changing/updating the same field,i.e updating how much time is left or some other such statistics.Basically achieving a counter effect. Is this a feature of printf()?? I thought maybe I could achieve the same effect by using fseek on STD-OUT_FILENO to rewind the cursor position n spaces inbetween calls to printf but i have read that manipulating SDTOUT in thiis way is not permitted.?!??. I would be much obliged if anyone could explain. I did try reading from the transcode source code;but i couldn't grasp how the feat was achieved. Is it an advanced programming feat? Thnks in advance. |
I think it print to stderr and use '\r' char to go to begin of line (as wget does
with its progress bar) Code:
fprintf(stderr, "Hello"); |
thats great.thnks for quick response.
|
Alternatively, you could output backspaces (^H) to backup the cursor.
|
And if you need more control than this, look into how to set the TTY to raw mode, or just use ncurses.
|
Hi
thnks again 4 the advise. Once in raw mode what other options are open to me.? Will I then be able to manipulate stdout like any other file descriptor?? I'd prefer not to have to go down the ncurses option yet. thnk u. |
Quote:
Steve |
All times are GMT -5. The time now is 11:57 AM. |