Re: CFStringRef to cstring in c++?
Re: CFStringRef to cstring in c++?
- Subject: Re: CFStringRef to cstring in c++?
- From: robert <email@hidden>
- Date: Tue, 24 Sep 2002 10:13:12 +0200
- Mail-followup-to: email@hidden
>
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?
I use something along the following:
CFStringRef pstr;
char *value = (char *) malloc(512);
MIDIObjectGetStringProperty(ref, propertyID, &pstr);
CFStringGetCString(pstr, value, 512, 0);
CFRelease(pstr);
Ofcourse, you'll need to add some errorchecking and perhaps find a way to
find out the length of the string in 'pstr'; the code above was just a
quick-and-dirty hack :)
robert
_______________________________________________
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.