开发者

Finding a file path in c

I'm working on an iOS project and need to supply a file path for a sqlite call in a c function. I know for objective-c calls, you can use a function like this one to get the path:

+ (NSString *) FilePath:(NSString *) fileName {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    return [documentsDirectory stringByAppendingPathComponent:fileName];
}

I can't use this function in my c as it has to remain as-is (no obj-c). Is there a similar type of call in c, or is there a build setting in xcode4 to help put the code access t开发者_如何学运维he database file correctly? I've been banging my head against this and would appreciate any assistance! 7


Once you get your NSString, call -UTF8String or -cStringUsingEncoding: on it to get your C string able to be passed to your sqlite function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜