我做了一个壁纸的应用程序,就是把应用程序里面的图片保存到本地文件夹里面。我写完后再模拟器上运行正常,但是把它移植到真机上就保存失败?这是为什么?
void SetName(belle *pMe){
char time[50];
char temGroup[10];
char temGroup1[10];
char temGroup2[10];
char temGroup3[10];
char temGroup4[10];
char temGroup5[10];
JulianType rJulianDate;
GETJULIANDATE(0, &rJulianDate);
DBGPRINTF("wYear=%d,wMonth=%d,wDay=%d,wHour=%d,wMinute=%d,wSecond=%d\n",rJulianDate.wYear,rJulianDate.wMonth,rJulianDate.wDay,rJulianDate.wHour,rJulianDate.wMinute,rJulianDate.wSecond);
SPRINTF((char*)temGroup, "%d", rJulianDate.wYear);
SPRINTF((char*)temGroup1, "%d", rJulianDate.wMonth);
SPRINTF((char*)temGroup2, "%d", rJulianDate.wDay);
SPRINTF((char*)temGroup3, "%d", rJulianDate.wHour);
SPRINTF((char*)temGroup4, "%d", rJulianDate.wMinute);
SPRINTF((char*)temGroup5, "%d", rJulianDate.wSecond);
DBGPRINTF("%s-%s-%s-%s:%s:%s",temGroup,temGroup1,temGroup2,temGroup3,temGroup4,temGroup5);
MEMSET(time,0,sizeof(time));
STRCAT((char*)time,temGroup);
STRCAT((char*)time,temGroup1);
STRCAT((char*)time,temGroup2);
STRCAT((char*)time,temGroup3);
STRCAT((char*)time,temGroup4);
STRCAT((char*)time,temGroup5);
DBGPRINTF("=================%s",time);
MEMSET(pMe->savefilename,0,sizeof(pMe->savefilename));
STRCAT(pMe->savefilename,"fs:/mod/10888/");
STRCAT(pMe->savefilename,time);
STRCAT(pMe->savefilename,".jpg");
}
void ReadFile(belle *pMe,const char *myfile,const char *savefile)
{
int count;
AEEFileInfo pInfo;
AECHAR sh[20] ={'l','i','n','g'};
AECHAR ss[20] ={'s','s','s','s'};
pMe->pMyFile = IFILEMGR_OpenFile(pMe->pMyFileMgr,myfile,_OFM_READ);
if(pMe->pMyFile==NULL){
DBGPRINTF("ENTER pMe->pMyFile11 = NULL\n");
return;
}
IFILE_GetInfo(pMe->pMyFile,&pInfo);//读取文件大小
DBGPRINTF("pMe->pInfo->dwSize=%d\n",pInfo.dwSize);
pMe->mydata=(char *)MALLOC(pInfo.dwSize);//分配动态内存
if(pMe->mydata==NULL){
DBGPRINTF("mydata FAKL\n");
}
IFILE_Read(pMe->pMyFile,(void *)pMe->mydata,pInfo.dwSize);
IFILE_Release(pMe->pMyFile);
pMe->pMyFile = IFILEMGR_OpenFile(pMe->pMyFileMgr,savefile,_OFM_READWRITE);
if(pMe->pMyFile==NULL){
//pMe->pMyFile = IFILEMGR_OpenFile(pMe->pMyFileMgr,"fs:/mod/10888/myfile.jpg",_OFM_CREATE);
pMe->pMyFile = IFILEMGR_OpenFile(pMe->pMyFileMgr,savefile,_OFM_CREATE);
if(pMe->pMyFile ==NULL){
IDISPLAY_DrawText(pMe->a.m_pIDisplay,AEE_FONT_NORMAL,ss,-1,20,60,NULL,IDF_ALIGN_CENTER);
return;
}
}
count = IFILE_Write(pMe->pMyFile,(void *)pMe->mydata,pInfo.dwSize);
if(0 == count)
{
IDISPLAY_DrawText(pMe->a.m_pIDisplay,AEE_FONT_NORMAL,sh,-1,20,20,NULL,IDF_ALIGN_CENTER);
}
IFILE_Release(pMe->pMyFile);
FREE(pMe->mydata);
}