• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1511
  • Last Modified:

cursor positioning on screen using c/c++

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
sashraja
Asked:
sashraja
  • 3
  • 3
  • 2
  • +2
1 Solution
 
ExceterCommented:
>> but gotoXY is not working on microsoft Visual studio.

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

Exceter
0
 
mrwad99Commented:
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
 
sashrajaAuthor Commented:
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!

 
KocilCommented:
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
 
ExceterCommented:
>> 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
 
KocilCommented:
The free Borland C++ 5.5 is only command line compiler without IDE.
0
 
mrwad99Commented:
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
 
ExceterCommented:
>> 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
 
mrwad99Commented:
sashraja.........

Did that work ok ?!?!?!?!
0
 
jmcgOwnerCommented:
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!

  • 3
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now