this is my thread for the timer which i use:
void *timer(void *arg){
current = time(0);
stop = current 30;
while (1){
current = time (0);
if (current <= stop){
now=stop-current;
mvprintw(0,0,"%d",now);
refresh();
}
}
return NULL;
}
Edit (from comments)...
i forgot to mention that im using :
pthread_t timerth; pthread_create(&timerth, NULL, timer, NULL);
i need to print the "timerleft" value but the output looks like this :
Is there any way to print it normally? Am I missing something?
Thank you for the help.
CodePudding user response:
Maybe you need to save and restore the current cursor position??
void *timer(void *arg) {
int x, y;
getyx(stdscr, y, x);
/* ... */
move(y, x);
return NULL;
}
CodePudding user response:
Try to add \r at the end of print string like so
mvprintw(0,0,"%d \r",now);