Thread: Standard way to clear the console (?)

  1. #16
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Unless you are making a game.
    I disagree. Text mode games that cannot be more easily written using a graphics API do not need the screen cleared. IMO there's no real reason to clear a console screen unless you're using some form of graphical interface that users won't use with the expectation of keeping their old output. But because text is "easier" to work with than graphics (that's total BS in practice), beginners will continue to ask this question.
    My best code is written with the delete key.

  2. #17
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Perhaps I'm old fashioned, but why avoid a feature just because it's not portable? By that rationale, you'd never ever use a graphics library. Or you'd never use any other library either, if it didn't run on every computer.

    I can see striving for portable code, but for something like a game, is it possible? Perhaps the best you can hope for is to choose a library which runs on more than one machine, like OpenGL.

  3. #18
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>If what I was making wasn't a game, I wouldn't even touch the console.
    I find consoles very useful, especially for whipping up quick test or utility applications. In fact, if what I was making WAS a game, I wouldn't even touch the console... but if it wasn't, there'd be a pretty good chance I would
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  4. #19
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >but why avoid a feature just because it's not portable?
    You don't, that's stupid. What you do is program as portably as possible by isolating the non-portable parts so that they're easier to replace. I think the point is not whether clearing the screen is portable, but whether it is prudent in a console mode program. I don't think it is, but that's obviously my own opinion.
    My best code is written with the delete key.

  5. #20
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    i think it's important to learn.. and practice good programming habits right from the beginning. Self-documenting code, compliance to the standard and modern coding conventions, initializing newly created objects to avoid garbage, proper formating, commenting... program portability.. optimization techniques... i think by doing all these things your code will be realiable, robust, secure, and scalable amoung all OS platforms. Taking cheap and easy shortcuts like system("cls") i think is good for new students.. or for homework purposes i guess.. but why not hold yourself to a higher standard. We are not spending our friday nights at home in front of the computer learning complex high-level programming languages for nothing.. if you like what you do.. then why not do the best you can. Yes.. there may be different schools of thought on some issues.. but if you think you have a better solution.. then offer your perspective.. and be prepared to back up your argument.

    Let the c++ standard, big-o notation, and modern coding conventions be the final determinant on how to implement a particular function or algorithm.
    Last edited by The Brain; 09-12-2004 at 09:56 AM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  6. #21
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Yeah, I googled Big-O notation...

    Does anyone have a site that will automatically make me smarter...

    What is C++?

  7. #22
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Does anyone have a site that will automatically make me smarter...
    www.google.com
    My best code is written with the delete key.

  8. #23
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Quote Originally Posted by Prelude
    "Crushing dreams at the speed of sarcasm."
    Isnt that the truth...
    What is C++?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Console window won't clear past app
    By LLINE in forum C++ Programming
    Replies: 4
    Last Post: 03-09-2009, 06:01 AM
  2. Console, Terminal and Terminal Emulator
    By lehe in forum C Programming
    Replies: 4
    Last Post: 02-15-2009, 09:59 PM
  3. One process with two console windows
    By siavoshkc in forum Windows Programming
    Replies: 8
    Last Post: 01-30-2009, 04:13 PM
  4. Replies: 12
    Last Post: 05-06-2006, 03:34 PM
  5. Using a button to clear a list box!
    By Unregistered in forum C++ Programming
    Replies: 13
    Last Post: 08-23-2002, 07:44 PM