Move cursor on  console screen in C++

Posted on 2008-11-06
Last Modified: 2012-08-13
How to move cursor to the point what have coordinate assigned before .

Question by:nickphson
    LVL 2

    Accepted Solution

    You can use the following Windows function.

    remember to #include "Windows.h"
    COORD coord;
    coord.X = 20; // your X cord
    coord.Y = 20; //your Y cord
    SetConsoleCursorPosition(GetStdHandle( STD_OUTPUT_HANDLE ),coord);

    Open in new window


    Author Comment

    I'm coding in window32 console not in window application.
    LVL 2

    Expert Comment

      When I told to include "Windows.h". It does'nt mean that it is a windows application. It is just included so that you can access the Windows API.

    I have tested the code in a WIN32 console application under Visual C++ 6.0 IDE.

    Thanks & Regards,


    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
    In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now