Solved

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

Posted on 2004-08-23
7
1,156 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

930 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

10 Experts available now in Live!

Get 1:1 Help Now