• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CFStringRef to cstring in c++?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFStringRef to cstring in c++?


  • Subject: Re: CFStringRef to cstring in c++?
  • From: Richard Fox <email@hidden>
  • Date: Tue, 24 Sep 2002 12:20:48 +1000

On Tuesday, September 24, 2002, at 12:04 PM, Gary Scavone wrote:

> This is probably a stupid question, but I haven't found an answer in
> my various searches.
>
> I just want to determine and print the names of the MIDI sources found
> by the system. The MIDIObjectGetStringProperty() function returns the
> name as a CFStringRef (which I learned is also a NSString *). What do
> I have to do, in C++, to get the name in the form of a common C
> string?

CFStringRef stringRef;
char cstring[64];

MIDIObjectGetStringProperty (dev, kMIDIPropertyModel, &stringRef);
CFStringGetCString (stringRef, cstring, sizeof(cstring), 0);
CFRelease (stringRef);

Check out
<http://developer.apple.com/techpubs/macosx/CoreFoundation/
StringServices/String_Services/index.html> for the String Services
reference, there are different functions for getting the actual data or
making copies.

Cheers,
Richard

---
Richard Fox
LiveTime Software
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: CFStringRef to cstring in c++?
  • Next by Date: Re: CFStringRef to cstring in c++?
  • Previous by thread: CFStringRef to cstring in c++?
  • Next by thread: Re: CFStringRef to cstring in c++?
  • Index(es):
    • Date
    • Thread