I'm using the gotoxy function, so I can write in a certain coordinate:
#include <stdio.h>
#include <windows.h>
void gotoxy(int x, int y){
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),(COORD){x-1,y-1});
}
main(){
#chamando a função
gotoxy(40, 20);
printf("testando");
}
The function positions and writes normally in the coordinate, but when using another printf("\ntestando")
, the text is written from the line chosen in the function, in the case of the example, in line 21.
-
Is there any way to return to the line that was initially, when the function was called?
-
When using a coordinate repositioning function, is the program writing control lost?