Thread: what is space in c++??

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    117

    what is space in c++??

    what is space in c++??

    example: \\ = "\"; \n ="return";......etc

    thank you for helping.

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    uh.... ' ' is space or 0x20 for that matter. Maybe I misunderstand.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    According to this nifty site, there is no escape sequence for a space. Just use ' '. There's really no reason for space to have an escape sequence. Typing a space is no much easier.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  4. #4
    Registered User V1P3R V3N0M's Avatar
    Join Date
    Jan 2003
    Posts
    22

    Right!

    In fact, you can use '\x20'.

    V1P3R V3N0M
    [email protected]

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231

    Re: Right!

    Originally posted by V1P3R V3N0M
    In fact, you can use '\x20'.

    V1P3R V3N0M
    [email protected]
    You could, but you wouldn't be writing portable code. 0x20 is not a space on all systems (see the EBCDIC chart for example where it's 0x40).

    You can use isspace() to determine if a char is white space or not.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  6. #6
    Registered User V1P3R V3N0M's Avatar
    Join Date
    Jan 2003
    Posts
    22
    yup, thx

    but...

    will I test all chars between 0x1A and 0x45 before printing a space or are all the systems 0x20 or 0x40?

    anyway.. just use ' ' and the problem's gone

    V1P3R V3N0M
    [email protected]

  7. #7
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>will I test all chars between 0x1A and 0x45 before printing a space
    I don't get what you mean?

    >>are all the systems 0x20 or 0x40?
    Again, it's NOT guaranteed. So stick with ' ' as you already pointed out. That way the compiler sorts it all out for you.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #8
    Registered User V1P3R V3N0M's Avatar
    Join Date
    Jan 2003
    Posts
    22
    will I test all chars between 0x1A and 0x45 before printing a space
    I was saying that in the case the program was made to run on every OS'es, I'll have to test (with isspace()) every char code around 0x20 and 0x40 (so about 0x1A to 0x45) to be sure the character printed is really the space (in the case it changes a lot from an OS to another, to another and so on).

    but like I said.. we just use ' ' cuz there's no need to use the escape method to print a simple space!!!

    sorry for the confusion here

    V1P3R V3N0M
    [email protected]

  9. #9
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    And to clarify even more, isspace() does white space testing, not ' ' space testing. So you need to decide which to use depending on your requirements.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Out of space when compiling kernel
    By NuNn in forum Linux Programming
    Replies: 3
    Last Post: 04-01-2009, 02:43 PM
  2. disk space mysteriously gone
    By evader in forum C++ Programming
    Replies: 4
    Last Post: 01-21-2004, 01:30 PM
  3. Replies: 12
    Last Post: 05-17-2003, 05:58 AM
  4. someone who is good at finding and fixing bugs?
    By elfjuice in forum C++ Programming
    Replies: 8
    Last Post: 06-07-2002, 03:59 PM