Thread: Very simple and stupid question.

  1. #1
    Pawn, Pascal and C++
    Join Date
    Sep 2005

    Very simple and stupid question.

    Cant seem to find it anywhere.
    How do I simply clear one line or everything?

    An example...
    If I want to make a count down.
    Instead of doing:
    "10 9 8 7"...
    It would be:
    "10", then clear it out, "9", then clear it out again, "8"...


  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Out of scope
    You can use the backspace escape sequence ( \b ), but you'd have to implement some sort of time to have the number stay on the screen for a certain length of time.

    If you want a non-standard solution, you can try conio.h and it's gotoxy() function, and I'm sure windows.h has something, as well.
    Sent from my iPadŽ

  3. #3
    Registered User
    Join Date
    Nov 2005
    well one way is for the count down to be the only output on the screen until it is done. You could simply clear the screen before each number showed up. one way to do it is the
    system ("cls");
    It is a relativly slow process but it works and is very easy to implement into a program. but if you wanted all other line of text to show and only the number to dissapear. I couldnt help you there. I am relativly new to programming so I only know some functions. Hopefully this helped.

  4. #4
    Registered User major_small's Avatar
    Join Date
    May 2003
    please don't use system("cls"); it opens your program up to a security flaw.

    use the backspace character ('\b') with some of the timing functions from <ctime> to get yourself a nice looking countdown. this isn't the best way, but it's the most standard AFAIK.
    Join is in our Unofficial Cprog IRC channel
    Channel: #Tech

    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. rather a stupid question
    By BEN10 in forum C Programming
    Replies: 9
    Last Post: 06-26-2009, 06:17 AM
  2. Replies: 7
    Last Post: 11-04-2005, 12:17 AM
  3. Simple Question from Stupid Person...
    By Monmouth3 in forum A Brief History of
    Replies: 6
    Last Post: 10-02-2002, 08:47 AM
  4. Simple stupid question from a beginner
    By oyerth in forum C++ Programming
    Replies: 1
    Last Post: 04-07-2002, 06:32 PM
  5. simple question (cout << "two words")
    By bleach in forum C++ Programming
    Replies: 3
    Last Post: 12-29-2001, 12:49 PM