Solved

gotoxy() and clrscr() not working in Mic visual c++

Posted on 2004-08-23
7
1,184 Views
Last Modified: 2013-12-14
In the past i have always used boreland c++, i am now using Microsoft visual c++, i have created a new project and a "win console app". In my cpp file i am trying to use the gotoxy() function and the clrscr() function, but the complier does not recognise these functions! why is this? Do i need to add these function via a library? if so how, i have the following includes

#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include <string.h>
#include <dos.h>
#include <ctype.h>
#include <conio.h>

but it still does not recognise the above functions.

cheers,

Jim
0
Comment
Question by:jamesmcskeane
[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
7 Comments
 
LVL 19

Expert Comment

by:mrwad99
ID: 11869458
To set the cursor position in VC++, you need, for example:

#include <windows.h>
#include <stdio.h>

HANDLE hConsole = GetStdHandle ( STD_OUTPUT_HANDLE );

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

gotoxy() does not work in VC++.
0
 
LVL 19

Accepted Solution

by:
mrwad99 earned 25 total points
ID: 11869467
...and to clear the screen, read http://www.mvps.org/vcfaq/lang/7.htm
1
 
LVL 17

Assisted Solution

by:rstaveley
rstaveley earned 25 total points
ID: 11875911
If you don't want to change your spots, you might want to grab the functions from http://www.codeguru.com/Cpp/W-D/console/article.php/c3959/
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 12091159
Split points between rstaveley and myself.
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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

724 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