How do I reset the curser?

Started by
4 comments, last by Undeadlnsanity 18 years, 5 months ago
In the consol, in C++, What is the commands to reset the curser back to the top left? That way, when I'm writing the next peragraph, it will write over what is already there. Also, is there a way to lock the scrolling in the consol so if there are to many char, the top line willnot go off screen.
Will you play with me? (Grins Evilly)
Advertisement
Quote:
In the consol, in C++, What is the commands to reset the curser back to the top left? That way, when I'm writing the next peragraph, it will write over what is already there.


You can use SetConsoleCursorPosition () function

Quote:
Also, is there a way to lock the scrolling in the consol so if there are to many char, the top line willnot go off screen


If you're overwriting the console buffer using SetConsoleWindowInfo () and SetConsoleActiveScreenBuffer (), they won't be scrolled.

Hth
V@T
--> The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones <--
Make him mad enough to start repeating himself.


[grin] Sorry, I just couldn't resist.
{[JohnE, Chief Architect and Senior Programmer, Twilight Dragon Media{[+++{GCC/MinGW}+++{Code::Blocks IDE}+++{wxWidgets Cross-Platform Native UI Framework}+++
Frogot to mention, This is in basic c++, not .net or windows. Just the dos console the comes up with the basic cout.
Will you play with me? (Grins Evilly)
Quote:Original post by Xeneth
This is in basic c++, not .net or windows. Just the dos console the comes up with the basic cout.
If you aren't going to include any windows headers, the system("CLS") command is your only method for resetting the cursor; it clears the console and moves the cursor back to the upper left. There is AFAIK no method for any of the others you mentioned without using Windows-specific functionality.
{[JohnE, Chief Architect and Senior Programmer, Twilight Dragon Media{[+++{GCC/MinGW}+++{Code::Blocks IDE}+++{wxWidgets Cross-Platform Native UI Framework}+++
Just as a note you can use windows functions without having a windows application. You can use them in console apps.

This topic is closed to new replies.

Advertisement