I'm a student at C programming, I need some help (teacher cannot help me now) with an idea I had.
Basically, I wanted to show bottom screen current date / time in any program, I made a thread but I see, i.e., that when I'm listing some files, (too much printf) they appear on my bottom screen instead of normal screen. What I've tried atm is:
Code:
//Some includes
int _FLAG_TIME_DONE
void time_thread() //with his params (doesn't mind here)
{
//code
int x=wherex();
int y=wherey();
gotoxy(1,24);
printf("%s",time_string);
gotoxy(x,y);
//this way usually main thread writes text on 1,24 or after %s string
/*another idea I had */
int x=wherex();
int y=wherey();
_FLAG_TIME_DONE=1;
gotoxy(1,24);
printf("%s",time_string);
gotoxy(x,y);
_FLAG_TIME_DONE=0;
}
main()
{
//code
for(int i=0;i<20;i++) {
printf("This is a line"); getch;
while(_FLAG_TIME_DONE); //it should pause it until x,y are back on main window..
} //next step
}
That while is to stop main till thread puts back cursor x,y on origin coords, but it's flagged to low time that it never goes out of it -sigh-