0
May i know please from anyone who knows about the use of GOTO keyword in C and may i know the syntax?
Cursor positioning
5 Respuestas
+ 2
Liza Tolentino as Brian mentioned, it's very OS dependent, however if you use linux and xterm and the like, gnome-terminal... you can use escape sequence like printf("\033[2;3H");
also use ncurses library, which is a bit harder.
PDCurses is another library you can use both on DOS, OS/2, windows and linux.
But if you are on windows, you can just include the windows.h and use
SetConsoleCursorPosition() function.
this function gets two arguments, a window handle and a COORD structure. it will be like this:
COORD cords = {2, 3};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), cords);
that will set the cursor pos to col 2 and row 3
+ 1
I mean... How to relocate a cursor on the screen space. For instance, i wish to move the cursor coming from left corner of the screen, then move to the center of the screen. How would I do such cursor movement like that?
+ 1
For screen addressing it is hard to give advice because there is no universal way that works everywhere. I have done it by writing my own routines that print escape sequences that are interpreted by some consoles as cursor commands. There is a library available on some systems called ncurses, which flexibly works on a variety of consoles. Unfortunately, it is unsupported on Sololearn's console.
+ 1
I'll try this. Thank you so much
0
Here is an example:
https://code.sololearn.com/cvVc8qGX4GAl/?ref=app
Place a label in the location to goto. In this case, I named it skip1.