kimo_liz
kimo_liz

Reputation: 33

I need a way/function that sets the cursor to the first line

I was trying to print a transaction for my project, but I wanted to set the cursor back to the first line so as to be able to make it work better. I don't want to use system("cls") because it deletes all the page, and then the transaction will not look cool.

I tried cout<<string(200,'\b'); and cout<<string(200,'\r');

the one I want to make transaction to

Upvotes: 0

Views: 113

Answers (1)

kimo_liz
kimo_liz

Reputation: 33

I could use the SetConsoleCursorPosition() function in the windows.h header, like this:

COORD coor;
coor.X = 0;//where x should be
coor.Y = 0;//where y should be
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coor);//where it should set the cursor back

Upvotes: 1

Related Questions