Objective-C から pathForResource 機能を C++ に公開しようとしています。
ただし、私はobjective-cに非常に慣れていないため、ac文字列をobjective-cの引数として使用する方法を識別できませんでした。明らかに私はここで間違った考えを持っています。c 文字列を引数として使用するように pathForResource を取得するにはどうすればよいですか?
ここに私の機能があります:
static std::string getAssetPath(std::string name, std::string ending)
{
const char * nameChar = name.c_str();
const char * endingChar = ending.c_str();
NSString* assetPath = [NSBundle pathForResource:&nameChar
ofType:&endingChar];
std::string str;
str = std::string([assetPath cStringUsingEncoding: NSASCIIStringEncoding]);
return str;
}