ClearScreen

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 ...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    195

    ClearScreen

    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?

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Does clrscr not appear in VC++ conio?
    Nope, you have to fake it.
    My best code is written with the delete key.

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    118
    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 08:00 PM.
    Why drink and drive when you can smoke and fly?

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    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.

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    75
    Or you could just write your 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_
    Just include it as a header file...and well then youve got your very own clear screen function
    MSVC++~

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. clearscreen using borland libraries
    By ryan_germain in forum C++ Programming
    Replies: 2
    Last Post: 08-04-2004, 10:50 AM
  2. clearscreen
    By Jotun in forum C++ Programming
    Replies: 3
    Last Post: 04-18-2004, 04:55 PM
  3. Windows console... clearscreen?
    By gMan in forum Windows Programming
    Replies: 8
    Last Post: 04-11-2003, 02:18 AM
  4. Clearscreen, no, not the usual question!
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2002, 02:05 AM
  5. ClearScreen so bad you cant see anything
    By bluehead in forum C++ Programming
    Replies: 9
    Last Post: 02-26-2002, 01:37 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21