안드로이드 개발 질문/답변
(글 수 45,052)
안드로이드 에서 cocos2d-x 로 개발하고 있습니다. 헌데 파일 로딩이 잘 안되서 질문좀 드릴께여.. 파일은 Resources 폴더에 넣어두고...파일을 로딩했거든여..
unsigned char* HelloWorld::loadData(char* path){
unsigned char* tmpData = NULL;
string* fullpath = CCFileUtils::fullPathFromRelativePath((char*)"0_0.map");
int size = 0;
FILE* file = fopen(fullpath.c_str(),"r");
if(file != NULL){
.........
}
fclose(file);
return tmpData;
}
파일 로딩하는걸 이렇게 만들었는데.. 폰에서 실행하니깐...파일을 못 불러오더라구여...
fullpath 를 출력해보니깐... 0_0.map 이것만 출력이 되던데...쩝..;;path를 어떻게 구해야 되나여??




data폴더 안에 패키지명 밑으로 넣으셔야 하는데,
예를들어서 com.entz.app 이라는 앱이라면,
path는 data/data/com.entz.app/filename 으로 하시면 될 것 같습니다.