Thread: Dev C++ Clear Screen

  1. #1
    Registered User MiLo's Avatar
    Join Date
    Jun 2004
    Posts
    17

    Dev C++ Clear Screen

    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:

    12. I am having problems using Borland specific functions such as clrscr()

    Include conio.h to your source, and add C:\Dev-C++\Lib\conio.o to "Further Object Files" in Project Options (where C:\Dev-C++ is where you installed Dev-C++)
    I think that has soemthing 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.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    FAQ -> How do I clear the screen?

    Welcome to the boards.

    gg

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Well his question isn't so much about how to do it as much as how to get clrscr() to work with Dev-C++.
    I looked into finding the "Further Object Files" to no avial. I suggest you try their forum at http://sourceforge.net/forum/forum.php?forum_id=48211 for more specific help.

  4. #4
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    how on earth is mircosoft going to help him with dev c++?
    [edit]never mind he delted his post[/edit]
    Last edited by prog-bman; 06-17-2004 at 06:34 PM.
    Woop?

  5. #5
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    how on earth is mircosoft going to help him with dev c++?
    Who said anything about microsoft?

  6. #6
    Registered User MiLo's Avatar
    Join Date
    Jun 2004
    Posts
    17
    Quote Originally Posted by Codeplug
    FAQ -> How do I clear the screen?

    Welcome to the boards.

    gg
    Ya i acctaully looked at it hence the reference i made to it.

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

    It doesn't acctully tell me how to set up dev to use the clrscr() function, it only says that some compilers have it. I was looking at some other stuff and it said that i should be able to set it up to work but i am new to this and i can't figure out what it was saying. I'm going to try and continue to read stuff over at the fourm Thantos suggested but if anyone has been able to figure this out and would like to explain it to me that would be great.

    Also im not really attached to Dev yet, so if anyone has some suggestions on what compiler i should download that maybe will just let me use clrscr() without having to mess around and pull my hair out that would be great. I'm starting to consider the throw moniter out the window clearscreen solution. Sounds like it would work very nicely.
    Thanks

  7. #7
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    My usual advice is to either not clear the screen (because it serves little purpose in console programs) or use a graphics library that supports such functionality (where it would be more useful).

    As for the compiler to download for clrscr, that would be a Borland compiler. To my knowledge, clrscr is specific to their implementation.
    My best code is written with the delete key.

  8. #8
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    If you're going to use Dev-C++, go to the FAQ posted by Codeplug, and use OPTION 7 (Windows Console Option). It looks scary, but just cut and paste the function in your code, or put it in a header file (.h) and include that at the top (#include "my_header.h").

  9. #9
    Registered User MiLo's Avatar
    Join Date
    Jun 2004
    Posts
    17
    Quote Originally Posted by swoopy
    If you're going to use Dev-C++, go to the FAQ posted by Codeplug, and use OPTION 7 (Windows Console Option). It looks scary, but just cut and paste the function in your code, or put it in a header file (.h) and include that at the top (#include "my_header.h").
    Thanks alot. I got it working and i think i even managed to write my own header file. Is it possible to have that header file part of the conio.h file that i am useto using. Can i just go in and edit that file somehow. I tried copy and pasting it in just as it appears in the FAQ but it doesn't seem to work. Any ideas?
    Thanks so much for putting up with all these questions.

  10. #10
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    if you want you can just write a header called clearscreen.h and then put it in your include folder and the just put
    Code:
    #include <clearscreen.h>
    //rest of header files
    into your cpp file and you can use the clrscr() function
    Woop?

  11. #11
    Registered User MiLo's Avatar
    Join Date
    Jun 2004
    Posts
    17
    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
    Code:
    #include <clearscreen.h>
    //rest of header files
    into your cpp file and you can use the clrscr() function
    Thats what i did. I am just wondering if i can put the code for the clearscreen into a file i already include all the time so i don't always need to include this one file for only one little thing.

  12. #12
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You usually don't want to go around modifying the standard headers. Besides, how hard is it to type one line?

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

  13. #13
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    sure i guess but thats not something i would do
    Woop?

  14. #14
    Registered User MiLo's Avatar
    Join Date
    Jun 2004
    Posts
    17
    Hmm you could be right. That could get somewhat confusing in the future. I think ill just stick to my own file. Thanks for all your help guys.

  15. #15
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Echo Quzah and prog-bman. And if you're still curious about how to add conio.o, you have to create a new project first. I think it's:
    File->New->Project

    Then you should be able to do what the Bloodshed FAQ says. A project allows you to add several different source (.c) files. Then when you compile, the compiler will create one executable file from them. But creating a Project also allows you to do stuff like adding conio.o as a Further Object File.

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