Hi - I am writing a terminal application in C on Ubuntu 8.10 and I'm having some problems when clearing the terminal screen to update my UI.
I am using the "magic incantation":
at the beginning of my UI function so that every time the UI is printed, the terminal is initially cleared before printing so that my values are updated.Code:printf("\033[2J"); printf("\033[0;0f");
Problem is - this seems to work for a while, like maybe 30-40 secs and then the terminal seems to stop clearing and the UI is printed continually down the terminal screen before the terminal seems to crash and not print anything more.
Really confusing me - don't really want to have to use system(clear) as from what I gather this is a pretty amateur way to program?
Anyone any ideas?
Just as an update - replaced the "magic incantation" above with
to see what happened and it did the exact same thing. Works perfectly for about 30-40 secs and then stops clearing the terminal and prints down the screen.Code:system("clear");