• Advertisement
Sign in to follow this  

Returning the cursor position C++

This topic is 3344 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, was just wondering how it is possible to return the cursor position in a C++ console application? Essentially I want to be able to do the following.... unknown number of lines [insert some text here] I already know how to add text at a specific location I just need to be able to return the current cursor location so I can tack something on the end. Cheers.

Share this post


Link to post
Share on other sites
Advertisement
Ah ok, makes sense as I'm already using a windows function to insert text at a specified location. Thanks for your help I'll read up on that function.

Share this post


Link to post
Share on other sites
Ok just as a follow up, this is how I solved my problem....


// Create struct to hold the console screen buffer info
CONSOLE_SCREEN_BUFFER_INFO csbi;

// Fill the structure with the buffer information
GetConsoleScreenBufferInfo(getStdHandle(STD_OUTPUT_HANDLE), &csbi);

// You can then use csbi.dwCursorPosition.X and csbi.dwCursorPosition.Y to access the current cursor position



Thanks again for your help Evil Steve!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement