Clear

This is a discussion on Clear within the C++ Programming forums, part of the General Programming Boards category; Is there a way to specifically clear a variable?...

  1. #1
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Clear

    Is there a way to specifically clear a variable?

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    It depends on what you mean by clearing and what kind of variable you mean.

  3. #3
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Example

    I want to clear a char. I'm using borland c++.

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    Assume c is a variable of type char then you can clear it by:

    c = '\0';

  5. #5
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Question Specific

    Is there anything more specific than that because it doesn't seem to work on borland c++.

  6. #6
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    c^=c;
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  7. #7
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Question Reply

    Not to be rude but could you be a little more specific, Stoned Coder? Or could someone, please, define what he just said?

  8. #8
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    c^=c;

    is a piece of sourcecode that will set c to zero.

    You cannot 'clear' a variable. A variable always has a state. You can define one as clear, like zero, but the variable will always have a value.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  9. #9
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Unhappy Work

    Doesn't work... do you need any header files?

  10. #10
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    523
    Can you post the offending code.
    I'd like to see this mutinous variable in action
    Last edited by C_Coder; 02-10-2002 at 01:20 PM.

  11. #11
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Lightbulb Gotoxy Clear

    This might make it easier... how do you clear a coordinate ... with gotoxy?

  12. #12
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    523
    Are you trying to clear a point on the screen or a variable in memory.
    At the start of this thread it sounded like you wanted to clear the variable, now you mention gotoxy it's sounds like you want to clear a point on the screen.
    Which is it???????????????????????????

  13. #13
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    drdroid, your question isn't exactly specific. To get help, you need to give us the details of your problems.

  14. #14
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Exclamation Gotoxy

    It's a point on the screen. Noone answered the first question so I changed it to see if there was a responce. How do you clear a specific point on the screen?

  15. #15
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Exclamation Maze Editor(specific)

    I'm creating a maze editor in which you create walls then move on to create more walls. I don't want to delete the whole thing, just the asterisk(the pointer, or mouse that you move around to create walls).

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. About clear(). Please help!
    By Antigloss in forum C++ Programming
    Replies: 12
    Last Post: 07-14-2005, 04:02 AM
  2. MFC: Clear Client Area
    By mrafcho001 in forum Windows Programming
    Replies: 2
    Last Post: 06-27-2005, 01:35 PM
  3. How to Clear in Visual C++ 6.0
    By MyDestiny in forum Windows Programming
    Replies: 1
    Last Post: 03-16-2005, 10:57 AM
  4. Yet another clear screen thread :D
    By kermit in forum Linux Programming
    Replies: 2
    Last Post: 11-20-2003, 04:14 AM
  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

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