cls() vs system("cls")

This is a discussion on cls() vs system("cls") within the C++ Programming forums, part of the General Programming Boards category; I am wondering why devC++ will only take system("cls") to clear the screen and not cld() function. Is it part ...

  1. #1
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475

    cls() vs system("cls")

    I am wondering why devC++ will only take system("cls") to clear the screen and not cld() function. Is it part of the borland functions? Because I downladed a source from planetsourcecode.com and in the example I compiled it seemed to accept it. But when I tryed it out on my own it said:

    ERROR: 'cls' undelcared first use of this function

    I am thinking perhaps the code I had was created on a different IDE/compiler setup to the one I have.

    The point of all this, is I want to use somthing else from system("cls") as I know it can leed to security leaks in code.

    I have read the FAQ on this and most of them do not work on my IDE

  2. #2
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,696
    > I have read the FAQ on this and most of them do not work on my IDE
    Choose one of the ways that do. The answer to that question is pretty thorough.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Because I downladed a source from planetsourcecode.com
    Just FYI, but the quality of implementation on planetsourcecode tends to be skewed toward the crap end of the spectrum.

    >and in the example I compiled it seemed to accept it.
    You compiled it with Dev-C++? Did the code you downloaded implement such a function?

    >I am thinking perhaps the code I had was created on a different IDE/compiler setup to the one I have.
    If it was and used non-portable extensions, your compiler would probably fail to compile it.

    >I have read the FAQ on this and most of them do not work on my IDE
    My usual advice is to stop wasting your time on such silly things. Clearing the screen in a console mode program is a frivolous and often unnecessary feature in a well designed program.

    >I have read the FAQ on this and most of them do not work on my IDE
    You said you have Dev-C++, right? Let's see:

    Option 1: Dev-C++ supports clrscr
    Option 2: Barring no way to figure out the exact height of the screen, this solution will work everywhere.
    Option 3: Curses are readily available
    Option 4: This won't work.
    Option 5: I fail to see how your compiler affects this.
    Option 6: This will work on Dev-C++.
    WINDOWS CONSOLE OPTION: Dev-C++ supports the Win32 API.

    So out of seven options, only one will not work on your IDE. That hardly justifies your use of "most of them", and it suggests that you're simply being lazy.
    My best code is written with the delete key.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Even Borland doesn't have a cls() function as far as I know, only clrscr(). cls() must have been something in the example itself.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    Thanks prelude for your advise. But can I point out that I am rather insulted by your recomendation that I am being lazy. I was only asking if anyone can help me out with a problem and I am very greatful that you suggested helping me but I prefer not to be called incompetant. DevC++ is a dead project nowdays as I am sure you know anyway so I was having difficulty in finding the answer I was looking for.

    I like this forum and find the help I get and get to give is all part of the learning process. But calling sombody lazy who was just seeking help is just not on

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >But can I point out that I am rather insulted by your recomendation that I am being lazy.
    You'll get over it.

    >I prefer not to be called incompetant.
    I didn't call you incompetent. I called you lazy. Actually, I didn't call you anything. I simply commented on how your question suggests that you're lazy. I came to that conclusion based on my experience with Dev-C++ (and how all but one of the options work just fine), and the extremely short time it took me to grab the two links I provided. I'm not exceptionally smart, so I think it's safe to assume that if you couldn't get any of the options to work to your satisfaction, or find any alternatives, you're simply being lazy. I call it like I see it. Deal.
    My best code is written with the delete key.

  7. #7
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    Ok then. i am not going to argue this any further. As you said, you told it as you saw it. It proves I am an idiot and did not think more carefully about how I worded my question. I do aplogise for that, I you have made this clear that in the future I think more of what I type and read and learn more before I post a thread

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 09:25 AM
  2. problem with the computers replie to the input
    By Nimble in forum C Programming
    Replies: 2
    Last Post: 04-30-2008, 03:21 PM
  3. Replies: 15
    Last Post: 05-13-2006, 09:28 PM
  4. system("cls")
    By xddxogm3 in forum C++ Programming
    Replies: 6
    Last Post: 12-08-2003, 03:23 PM
  5. cls
    By fkheng in forum C Programming
    Replies: 4
    Last Post: 06-10-2003, 06:45 AM

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