Syntax Question

This is a discussion on Syntax Question within the C++ Programming forums, part of the General Programming Boards category; I want to pass text into a variable the has the " character. When it gets to the second " ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    15

    Talking Syntax Question

    I want to pass text into a variable the has the " character. When it gets to the second " character it is treating it as the end of the statement creating a syntax error. I want it to treat the second and third " characters in my statement below as characters. Is there a way to do this in C++? My code is below. Thank you in advance for looking and helping.

    Derek

    Code:
      csDesc = "the average ("person") will accept";

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    use \"

  3. #3
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Code:
    csDesc = "the average (\"person\") will accept";
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  4. #4
    Registered User
    Join Date
    Mar 2005
    Posts
    15

    Thank you.

    Thank you both for your replies!!!

    Derek

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Syntax question: &(++x)
    By yoshiznit123 in forum C Programming
    Replies: 8
    Last Post: 06-02-2006, 11:40 PM
  2. using c++ in c code
    By hannibar in forum C Programming
    Replies: 17
    Last Post: 10-28-2005, 10:09 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  4. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 09:57 AM
  5. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM

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