How to get the path of resources in project?

In cocos2d : NSString* path = [[NSBundle mainBundle] pathForResource:“XXX” ofType:"XXX"];

But in cocos2d-x, I don’t know how to get ? help me ,thanks ?

There is not corresponding function in cocos2d-x.
Why did you want this function?

Its likes this CCFileUtils::fullPathFromRelativeFile(“filename”),and the detail you will know from the class CCFileUtils………

I want load a xml file in resources by tinyXML; but I don’t know the path, so load failed.

tinyXML(“fileName.xml”);You must copy the file to the project Resource folder.

or
You pass the absolute path.
tinyXML(“fullPathoftheXML.xml”) like this /User/mac/……/fileName.xml;

CCFileUtils::fullPathFromRelativeFile(“filename”) will return full path of “filename”.

Thank you, everyone, I’m use " CCFileUtils::fullPathFromRelativeFile " succeed !

For 0.11 version, CCFileUtils::fullPathFromRelativeFile(const char pszFilename, const charpszRelativeFile), so what I should input for the second parameter pszRelativeFile? my xml file will be copyed to the assets directory and in which only some image file.
Someone can help me? Thank you so much!

const char *levelInf = CCFileUtils::fullPathFromRelativeFile(“…/Documents/levelInf.txt”, “levelInf.txt”);

That’s all.

Hi Yu qing Niu,
According to the fullPathFromRelativeFile method code in CCFileUtils_android.cpp:

const char* CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)
{
    std::string relativeFile = pszRelativeFile;
    CCString *pRet = new CCString();
    pRet->autorelease();
    pRet->m_sString = relativeFile.substr(0, relativeFile.rfind('/')+1);
    pRet->m_sString += pszFilename;
    return pRet->m_sString.c_str();
}

your code above

const char *levelInf = CCFileUtils::fullPathFromRelativeFile("../Documents/levelInf.txt", "levelInf.txt");

will return “…/Documents/levelInf.txt” the same as the first parameter, so I still confused about how this method works.

Oh sorry,it is the path of finder ,the position of the file on device with IOS , it is different from the path in simulator.

If you get your code to device with android OS from project on PC or you need set some files positions following your think,you can get the path of the

device with android OS .i use the fun set my configure file the position on which i want its in device with IOS.

……