If most people #include <conio.h> for clrscr() function, how come my conio.h doesn't seem to have it. Does clrscr not appear in VC++ conio?
This is a discussion on ClearScreen within the C++ Programming forums, part of the General Programming Boards category; If most people #include <conio.h> for clrscr() function, how come my conio.h doesn't seem to have it. Does clrscr not ...
If most people #include <conio.h> for clrscr() function, how come my conio.h doesn't seem to have it. Does clrscr not appear in VC++ conio?
>Does clrscr not appear in VC++ conio?
Nope, you have to fake it.
My best code is written with the delete key.
or use system("cls") that I think is in windows.h, it might be in conio.h
[EDIT]
Or maybe its in iostream.
Last edited by Marcos; 05-25-2003 at 07:00 PM.
Why drink and drive when you can smoke and fly?
system is in cstdlib and stdlib.h as it's a standard function in both C and C++.
My best code is written with the delete key.
Or you could just write your own clear screen function
Just include it as a header file...and well then youve got your very own clear screen functionCode://Basic Functions.. //basicf.h #ifndef _BASICF_H_ #define _BASICF_H_ #include<windows.h> void clrscr() { HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE); COORD cScreenStart={0,0}; DWORD dwScreenSize; DWORD dwCharsWritten; CONSOLE_SCREEN_BUFFER_INFO cWindowInfo; GetConsoleScreenBufferInfo(hOutput,&cWindowInfo); dwScreenSize = cWindowInfo.dwSize.X * cWindowInfo.dwSize.Y; FillConsoleOutputCharacter(hOutput,TEXT(' '),dwScreenSize,cScreenStart,&dwCharsWritten); GetConsoleScreenBufferInfo(hOutput,&cWindowInfo); FillConsoleOutputCharacter(hOutput,TEXT(' '),dwScreenSize,cScreenStart,&dwCharsWritten); SetConsoleCursorPosition(hOutput,cScreenStart); } #endif // _BASICF_H_![]()
MSVC++~