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. Advertisements

  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. Advertisements

  3. kittykat

    kittykat Guest

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

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:
    1,001
    Andrzej Jan Taramina
    Feb 2, 2004
  2. blrmaani
    Replies:
    4
    Views:
    14,645
    Karthik
    Apr 27, 2004
  3. Charles L

    Converting Character Array to String

    Charles L, Dec 3, 2003, in forum: C Programming
    Replies:
    14
    Views:
    896
    Kelsey Bjarnason
    Dec 8, 2003
  4. Brand Bogard

    8 bit character string to 16 bit character string

    Brand Bogard, May 25, 2006, in forum: C Programming
    Replies:
    8
    Views:
    990
    those who know me have no need of my name
    May 28, 2006
  5. Philipp
    Replies:
    21
    Views:
    1,516
    Philipp
    Jan 20, 2009
  6. Jimbo
    Replies:
    1
    Views:
    214
    Martin Honnen
    Dec 20, 2005
  7. Bart Vandewoestyne
    Replies:
    8
    Views:
    1,116
    Bart Vandewoestyne
    Sep 25, 2012
  8. Replies:
    1
    Views:
    213
    Mark Lawrence
    Oct 1, 2013
Loading...