?
Solved

cursor positioning on screen using c/c++

Posted on 2003-02-28
11
Medium Priority
?
1,501 Views
Last Modified: 2007-12-19
Hi,
I tried C/C++ program to place the cursor on screen position but gotoXY is not working on microsoft Visual studio.
Please anyone give me an idea how can i write a program for this using microsoft visual studio.
graphics.h wont work..i think..

0
Comment
Question by:sashraja
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 8

Expert Comment

by:Exceter
ID: 8045456
>> but gotoXY is not working on microsoft Visual studio.

I beleive that the gotoxy() function is Borland specific.

Exceter
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 8051485
I am trying to do exactly the same thing and am still trying out suggestions.  The information I have been given by experts so far is at

http://www.experts-exchange.com/Programming/Programming_Languages/C/Q_20520321.html

And yes, gotoXY will not work in MSVC++, but will in some other compilers.

:(
0
 

Author Comment

by:sashraja
ID: 8057902
Thx mrwad99,

I have the same problem as yours. I tried all the solution given for your questions but nothing worked for me. i am waiting for some to gimme a solution.

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:Kocil
ID: 8059544
This simple thing looks so complicated in MSVC++ :)
How about using BIOS interrupt

/*
INT 10 - VIDEO - SET CURSOR POSITION
     AH = 02h
     BH = page number
     DH = row (00h is top)
     DL = column (00h is left)
Return: nothing
*/

#define geninterrupt(i) __int__(i)

void mygotoxy(unsigned char x, unsigned char y)
{
   _AH = 0x2;
   _BH = 0;
   _DH = x;
   _DL = y;
   geninterrupt(0x10);
}

Hey ... how about to use Borland compiler for your DOS project. It's conio.h kick ass.
Download it for free from http://bdn.borland.com/museum/

Turbo C 2.01 => C only, then a top choice
Turbo C++ 1.01 => support C++ but not so complete
 
0
 
LVL 8

Expert Comment

by:Exceter
ID: 8060886
>> how about to use Borland compiler for your DOS project

That would be the best course of action in my opinion. However, I would download Borland C/C++ 5.5. It is free to download from borland provided you register(Free) with them.

http://www.borland.com/products/downloads/download_cbuilder.html

Exceter
0
 
LVL 5

Expert Comment

by:Kocil
ID: 8062386
The free Borland C++ 5.5 is only command line compiler without IDE.
0
 
LVL 19

Accepted Solution

by:
mrwad99 earned 80 total points
ID: 8063270
This does the trick in MSVC++

#include <windows.h>
#include <stdio.h>
 
int main ( int argc, char** argv )
{
HANDLE hConsole = GetStdHandle ( STD_OUTPUT_HANDLE );

    if ( hConsole != INVALID_HANDLE_VALUE )
        {
        COORD pos = {32, 11};
        SetConsoleCursorPosition ( hConsole, pos );
        printf ( "Hello World!\n" );
        }
 
    return 0;
}

- DJ
0
 
LVL 8

Expert Comment

by:Exceter
ID: 8068356
>> The free Borland C++ 5.5 is only command line compiler without IDE.

So? If you really want an IDE download textpad, or an equivalent program, and inside 10 seconds of configuration it will compile your programs using any compiler you want.

Exceter
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 8245742
sashraja.........

Did that work ok ?!?!?!?!
0
 
LVL 20

Expert Comment

by:jmcg
ID: 10024356
Nothing has happened on this question in over 8 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by mrwad99 (acknowldging good responses from others, but too few points...).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses

752 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