Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <windows.h>
- #include <conio.h>
- int moveTo(int x, int y){
- COORD coord;
- coord.X = x;
- coord.Y = y;
- HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
- return SetConsoleCursorPosition(hConsole, coord);
- }
- void getCursorPosition(int* x, int* y){
- HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
- CONSOLE_SCREEN_BUFFER_INFO csbi;
- GetConsoleScreenBufferInfo(hConsole,&csbi);
- *x=csbi.dwCursorPosition.X;
- *y=csbi.dwCursorPosition.Y;
- }
- void moveToStart()
- {
- int x;
- int y;
- //Get Position
- getCursorPosition(&x,&y);
- //Move to Start
- moveTo(0,y);
- }
- void fillLine(){
- int width;
- int i=0;
- HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
- CONSOLE_SCREEN_BUFFER_INFO csbi;
- GetConsoleScreenBufferInfo(hConsole,&csbi);
- width=csbi.dwSize.X;
- moveToStart();
- for(i=0;i<width;i++){
- putchar(' ');
- }
- moveTo(0,csbi.dwCursorPosition.Y);
- }
- int ask(const char* Frage){
- int i=0;
- printf("%s [y/n]:", Frage);
- while(i!='y' && i!='n' && i!='Y' && i!='N'){
- i=getch();
- }
- putchar('\n');
- return i=='y' || i=='Y';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement