Created
June 20, 2018 13:42
-
-
Save j000/30a8c14e7a4dc23594f6865b278440d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define spacje " " | |
void prawa(int linia,char *tekst) | |
{ | |
pthread_mutex_lock(&print); | |
/* wyczyść linijkę */ | |
printf("\033[%u;0H" spacje spacje, linia); | |
/* przenieś kursor na prawą stronę */ | |
printf("\033[%u;0H" spacje, linia); | |
/* wypisz nasz tekst */ | |
printf("%s", tekst); | |
/* wypisz wewnętrzny bufor na konsole (trzeba, bo nie ma nigdzie \n) */ | |
fflush(stdout); | |
pthread_mutex_unlock(&print); | |
} | |
void lewa(int linia, char *tekst) | |
{ | |
pthread_mutex_lock(&print); | |
/* wyczyść linijkę */ | |
printf("\033[%u;0H" spacje spacje, linia); | |
/* przenieś kursor na lewą stronę */ | |
printf("\033[%u;0H", linia); | |
/* wypisz nasz tekst */ | |
printf("%s", tekst); | |
/* wypisz wewnętrzny bufor na konsole (trzeba, bo nie ma nigdzie \n) */ | |
fflush(stdout); | |
pthread_mutex_unlock(&print); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment