How can I find the path to a file in an application bundle (NSBundle) using C?
问题 Is there a C API for finding the path to a file in an application bundle? I know that this can be done in Objective-C with the following syntax. NSString *path = [[NSBundle mainBundle] pathForResource:@"MyImage" ofType:@"bmp"]; Is there a corresponding function that I can call from C or C++ code, as well? 回答1: After Mike K pointed me in the right direction, I was able to retrieve the path to a file in an application bundle with the following code. // Get a reference to the main bundle