请教cocos2dx怎么读取一个TXT文件并显示出来?
using std::string ;
string pathKey = CCFileUtils::sharedFileUtils()->fullPathForFilename("li.txt");
unsigned char* pBuffer = NULL;
unsigned long bufferSize = 0;
pBuffer = CCFileUtils::sharedFileUtils()->getFileData(pathKey.c_str(), "r", &bufferSize);
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
CCLabelTTF* pLabel = CCLabelTTF::create(pathKey.c_str(), "Arial", 24);
// position the label on the center of the screen
pLabel->setPosition(ccp(origin.x + visibleSize.width/2,
origin.y + visibleSize.height/2));
this->addChild(pLabel, 1);
我现在的程序是这样的