Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

AaronShlock

Basic C++ 'cout' question

This topic is 6024 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

How do you move the virtual cursor? For instance, say I had this line: cout<<"__________"; And then... cin>>x; But I want to have the cin OVERWRITE the cout... as in backing up the virtual cursor ten spaces so that whatever is typed will replace the characters below it...

Share this post


Link to post
Share on other sites
Advertisement
try this:

    

#include <windows.h>
#include <iostream>
usuing namespace std;

int main()
{

HANDLE H_OUTPUT = GetStdHandle(STD_OUTPUT_HANDLE);
COORD cursor = {0,0};

cout << "________";
SetConsoleCursorPosition(H_OUTPUT, cursor);
cin >> x;

return 0;

}



Try that I didn't test it but I think it will work.

COORD cursor is the place where you want it to go. Play around with the values and see what happens.

Jeff D


Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton


Edited by - Jeff D on February 17, 2002 2:36:56 AM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!