I'm writing a sound recorder for iOS in native C++ and i cannot use the Foundation API.
I need something like this:
(CFStringRef)[NSTemporaryDirectory() stringByAppendingPathComponent: @"recordedFile.caf"];
Sure you can, but speaking confidently this is a task for a client of mine and he requested no external functions or bridges or whatever involving Foundation in the core classes. So i had to built an audioqueue component without references to Foundation.
For the record, i succedeed just doing this:
const char *home = getenv("HOME"); const char *subdir = "/Documents/"; const char *file = "recordedFile.caf"; char *recPath = (char*)(calloc(strlen(home) + strlen(subdir) + strlen(file) + 1, sizeof(char))); strcpy(recPath, home); // copy string one into the result. strcat(recPath, subdir); // append string two to the result. strcat(recPath, file); // append string three to the result. //recordFilePath is our CFStringRef recordFilePath = CFStringCreateWithCString(0, recPath, kCFStringEncodingUTF8); //recorder is an AQRecorder class like the one from SpeakHere code sample recorder->StartRecord(recordFilePath);