Thread: Dev C++ Clear Screen

  1. #16
    Registered User MiLo's Avatar
    Join Date
    Jun 2004
    Posts
    17
    hmm thanks. I dunno, i don't think conio.o is even on my computer. I did a search for it and it didn't come up. Oh well, i've got what i wanted working now. I wont worry about trying and figuring out where that file is or why i don't have it. Not a big deal.

  2. #17
    Quote Originally Posted by Prelude
    As for the compiler to download for clrscr, that would be a Borland compiler. To my knowledge, clrscr is specific to their implementation.
    Indeed, but there is a port (conio.h / conio.c) in the include directory that makes the trick using console Win32 API functions.
    Emmanuel Delahaye

    "C is a sharp tool"

  3. #18
    Quote Originally Posted by MiLo
    I just downloaded Dev c++ because the complier i was using (TC LITE) didn't allow me to make exe files. It also wasn't windows based which is a pain editing in.

    What i am trying to do is get it to use clrscr(). I was looking at http://www.bloodshed.net/faq.html#6 and i found this:

    I think that has something to do with it, but i can't figure out how to do that. Does anyone know what that means or how i can go about doing this. I was looking around here and saw that i can use system("cls"); to clear the screen but it says it isn't a very good way of doing it. I would rather do it the good way. Thanks for your help.
    If you insist in clearing the screen, you can use the clrscr() from the conio port by Dev-C++ of the Borland C conio library.

    There is a conio.h interface file in .../INCLUDE of Dev-C++, and a conio.c implementation file at the same location. Just add the latter to your project, and include <conio.h> where you need it.
    Emmanuel Delahaye

    "C is a sharp tool"

  4. #19
    Quote Originally Posted by prog-bman
    if you want you can just write a header called clearscreen.h and then put it in your include folder and the just put <...>
    into your cpp file and you can use the clrscr() function
    Why in the world should the original poster have a .cpp file ? AFAIK, he is writing C-code (Gratuitous assumption based on the fact that he was posting to the C forum...)
    Emmanuel Delahaye

    "C is a sharp tool"

  5. #20
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    To clear the console using windows API do this:
    Code:
    void cls(){
    	CONSOLE_SCREEN_BUFFER_INFO conInfo;
    	DWORD dummy;
    	COORD home = { 0, 0 };
    	HANDLE hConsoleOut;
    
    	hConsoleOut = GetStdHandle( STD_OUTPUT_HANDLE );
    
    	if(hConsoleOut == INVALID_HANDLE_VALUE) return;
    
    	GetConsoleScreenBufferInfo( hConsoleOut , &conInfo );
    	FillConsoleOutputCharacter( hConsoleOut ,' ', conInfo.dwSize.X * conInfo.dwSize.Y, home, &dummy );
    	SetConsoleCursorPosition(hConsoleOut,home);
    }
    Dev - c++ suports windows libraries
    Last edited by xErath; 07-01-2004 at 12:44 AM.

  6. #21
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by xErath
    To clear the console using windows API do this:
    ...
    Dev - c++ suports windows libraries
    Looks like you could have just read the FAQ also.

    Quzah.
    Hope is the first step on the road to disappointment.

  7. #22
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    I also had some troubles using clscr() before, in devc++...
    This is just another possible implementation, if one's using VC++.. I don't know which function clears the console in windows.h

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CLear Screen Routine
    By AQWst in forum C++ Programming
    Replies: 4
    Last Post: 12-13-2004, 08:24 PM
  2. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  3. Getting a clear screen...
    By Finchie_88 in forum C++ Programming
    Replies: 13
    Last Post: 09-03-2004, 05:38 PM
  4. Clear Screen Again!!!
    By trang in forum C Programming
    Replies: 3
    Last Post: 12-13-2003, 08:36 AM
  5. Yet another clear screen thread :D
    By kermit in forum Linux Programming
    Replies: 2
    Last Post: 11-20-2003, 05:14 AM