C++ newbie problem
#include <iostream.h>
#include <conio.h>
void main(void)
{
clrscr();
cout << "Hello World";
}
compiler: error C2065: ''clrscr'' : undeclared identifier
what is the problem? sorry if it is a REALLY stupid question...
"Don''t think you are, know you are!''
I don''t think there is a clrscr() procedure. I looked through the VC++6 docs and there isn''t one listed there either.
-Sam.
-Sam.
Im not very well acquainted with the standard library but clrscr() is not a function there and I dont know of an equivalent.
its
system("CLS");
i think...
and include
BTW undeclared identifier means that it doesnt exist(in your Include's or Libraries).
[edited by - pipo declown on June 29, 2002 11:27:19 AM]
system("CLS");
i think...
and include
BTW undeclared identifier means that it doesnt exist(in your Include's or Libraries).
[edited by - pipo declown on June 29, 2002 11:27:19 AM]
There MOST DEFINITELY is a clrscr() function!!!! I don''t know why anyone would tell you otherwise without knowing more on the subject. The clrscr() function is part of the conio.h library, which you need to include. If you are including conio.h and it still is not working, you may have a problem with the compiler or you may have a bad version of conio.h. I think the most likely problem, though, is that the libraries may not be in your include folder. Exactly what errors are you getting?
"Now what I contend is that my body is my own, at least I have always so regarded it. If I do harm by experimenting with it, it is I who suffers, not the state. "- Mark Twain -
clrscr() isnt a listed prototype in conio.h or any of the other headers for that matter
clrscr was specific to borland compilers I believe. Search through the general programming, or for beginners forum it has been asked hundreds of times. There are solutions ranging from system("cls") to more robust functions that emulate clrscr. For instance:
[My site|SGI STL|Bjarne FAQ|C++ FAQ Lite|MSDN|Jargon]
Ripped off from various people
[edited by - wild_pointer on June 30, 2002 1:06:19 PM]
void clrscr(){ static HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); COORD coord = {0, 0}; DWORD dw; CONSOLE_SCREEN_BUFFER_INFO csbi; DWORD dwSize; GetConsoleScreenBufferInfo(hConsole,&csbi); dwSize = csbi.dwSize.X * csbi.dwSize.Y; FillConsoleOutputCharacter(hConsole, ' ', dwSize, coord, &dw); FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwSize, coord, &dw); SetConsoleCursorPosition(hConsole, coord);}
[My site|SGI STL|Bjarne FAQ|C++ FAQ Lite|MSDN|Jargon]
Ripped off from various people
[edited by - wild_pointer on June 30, 2002 1:06:19 PM]
[size=2]
quote: Original post by hmsimha
There MOST DEFINITELY is a clrscr() function!!!!
Not in Standard C or C++ there isn''t.
quote:
I don''t know why anyone would tell you otherwise without knowing more on the subject.
Because it''s correct.
quote:
The clrscr() function is part of the conio.h library, which you need to include.
That''s not a Standard header, but a vendor-supplied extension.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement