Converting string into character arrays

Discussion in 'C++' started by kittykat, Dec 1, 2004.

  1. kittykat

    kittykat Guest

    Hi,
    I was just wondering how can I convert a String into a char array?

    Your help would be greatly appreciated,
    Thanx in advance.
    kittykat, Dec 1, 2004
    #1
    1. Advertising

  2. kittykat

    Howard Guest

    "kittykat" <> wrote in message
    news:...
    > Hi,
    > I was just wondering how can I convert a String into a char array?
    >
    > Your help would be greatly appreciated,
    > Thanx in advance.
    >


    That depends: what's a "String"? If you mean the class called "string",
    first notice that it is spelled with a lower case "s", which is very
    important in C++. And in that case, you can call the c_str() function in
    the string class to get a pointer to the character array, from which you are
    free to copy to your own char array if you need. If you mean some other,
    third-party class called "String", then you'd be best off asking the
    creators of that class, or reading their manual.

    -Howard
    Howard, Dec 1, 2004
    #2
    1. Advertising

  3. kittykat

    kittykat Guest

    Thank you!
    kittykat, Dec 1, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrzej Jan Taramina

    XSLT: Converting a number into a character?

    Andrzej Jan Taramina, Jan 29, 2004, in forum: XML
    Replies:
    3
    Views:
    873
    Andrzej Jan Taramina
    Feb 2, 2004
  2. Brand Bogard

    8 bit character string to 16 bit character string

    Brand Bogard, May 25, 2006, in forum: C Programming
    Replies:
    8
    Views:
    719
    those who know me have no need of my name
    May 28, 2006
  3. Philipp
    Replies:
    21
    Views:
    1,111
    Philipp
    Jan 20, 2009
  4. Jimbo
    Replies:
    1
    Views:
    123
    Martin Honnen
    Dec 20, 2005
  5. Bart Vandewoestyne
    Replies:
    8
    Views:
    707
    Bart Vandewoestyne
    Sep 25, 2012
Loading...

Share This Page