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?
Printable View
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.
or use system("cls") that I think is in windows.h, it might be in conio.h
[EDIT]
Or maybe its in iostream.
system is in cstdlib and stdlib.h as it's a standard function in both C and C++.
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 function ;)Code://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_