Path for files inside assets folder

Hi,
I have a level editor in my game and when ever I edit a level i save the tmx file in sd card and also the tile set image that is used for that level.
To copy the tile set image from assets folder i did this.

@ ifstream source(“tileSet3.png”, ios::binary);
ofstream dest(“/mnt/sdcard/tileSet3.png”, ios::binary);

istreambuf_iterator begin_source(source);
istreambuf_iterator end_source;
ostreambuf_iterator begin_dest(dest);
std::copy(begin_source, end_source, begin_dest);
source.close();
dest.close(); @

this worked on both PC and android and i didnt bothered to check it for long time. I changed tileSet3.png and did some changes in project and when i run this program again on android it stopped working. (still working on PC)
I wanted to check why it’s not working and did this.

pr = fopen("tileSet3.png","rb"); if( pr ) CCLog("pr ok"); else CCLog("pr not ok"); pw = fopen("/mnt/sdcard/tileSet3.png","wb"); if( pw ) CCLog("pw ok"); else CCLog("pw not ok"); while(!feof(pr)){ fread(buf,1,1,pr); fwrite(buf,1,1,pw); } fclose(pr); fclose(pw);

I got “pr not ok, pw ok” in the log.
I tried changing path to “./tileSet3.png” and “/assets/tileSet3.png” but it didnt worked.
I tried to get the exact error by doing this

char str[256]; sprintf(str,"FileError: %s", strerror(errno)); CCLog(str);

This wont even compile in cygwin. it says “‘errno’ was not declared in this scope”. So i cant compile this for android.
So what is the path for assets folder? Is there any function in CCFileUtils that can return the assets folder path?

All the code is working on PC but not in android.

sorry my bad havent included errno.h
Now that i did included the error i get is
“No such file or directory”
So again struck at same question :frowning:
Path for assets folder or way to copy the image in assets folder to sd card.

I tried using CCFileUtils did this

CCFileUtils *fileUtils = CCFileUtils::sharedFileUtils();
unsigned long fileSize;
unsigned char *fileData = fileUtils->getFileData("tileSet3.png", "r", &fileSize);

pw = fopen("/mnt/sdcard/tileSet3.png","w");
fwrite(fileData, 1, fileSize, pw);
fclose(pw);

even this is not working. I kept break point to check what values the variables are holding.
and filedata has “‰PNG” and fileSize has 5.
while my file is 6.5Kb.

Got it working.
I’m sending wrong fileMode instead of “r” i sent “rb” and instead of “w” i sent “wb”

CCFileUtils *fileUtils = CCFileUtils::sharedFileUtils();
unsigned long fileSize;
unsigned char *fileData = fileUtils->getFileData("tileSet3.png", "rb", &fileSize);

pw = fopen("/mnt/sdcard/tileSet3.png","wb");
fwrite(fileData, 1, fileSize, pw);
fclose(pw);