how to convert CFString to c++ string

Discussion in 'Mac Programming' started by chidambaram, Apr 8, 2008.

  1. macrumors member

    Joined:
    Mar 9, 2008
    #1
    hi,

    I am working in a carbon c++ application using XCode.

    How can i convert CFString to c++ string?

    thanks in advance and urgent plz...
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Use one of the well document functions like this to turn it into an array of characters then convert that to a C++ String object?
     
  3. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #3
    http://paste.lisp.org/display/5105

    This will get you a char *, the step from there to std::string is short. There may be a more direct way, but this should work. I'd make a function that returns a string that does all that.

    -Lee
     

Share This Page