I'm creating an iPhone app that needs the location of .wav which is located in the sandbox. I do this wit开发者_如何学Ch the following:
recordFilePath = (CFStringRef)[NSTemporaryDirectory() stringByAppendingPathComponent: @"recordedFile.wav"];
How can I convert recordFilePath to a string that can then be passed into a C function?
EDIT 1
By the way, this is the statement that is going to receive the c string:
freopen ("locationOfFile/recordedFile.wav","r",stdin);
That will depend on what type your c function expects to get - you can write a c function that accepts NSString* object as parameter. If you want to convert your NSString
to char*
then you can use one of the following functions:
– cStringUsingEncoding:
– getCString:maxLength:encoding:
– UTF8String
精彩评论