写文件乱码问题!!模拟器没有问题,真机乱码!!!!
static int Write(ILog* a_pMe,const char* pFormat,...){#ifdef _DEBUG_ Loger* pMe=(Loger*)a_pMe; IFile * pFile=pMe->m_pFile; // declare time JulianType pDate; char* pTime; // declare log content. char* pLogContent; char nn[1024]; va_list cArguments; if (pFormat==NULL) return EFAILED; MEMSET(nn,0,1024); //malloc of pointer. pTime=(char*)MALLOC(sizeof(char)*SIZE); pLogContent = (char*)MALLOC(sizeof(char)*SIZE); // get current time and write into file. GETJULIANDATE(0,&pDate); SPRINTF(pTime,"[%4d-%02d-%02d %02d:%02d:%02d]:",pDate.wYear,pDate.wMonth,\ pDate.wDay,pDate.wHour,pDate.wMinute,pDate.wSecond); IFILE_Write(pFile, pTime, STRLEN(pTime));// 定位是这个地方出了问题!!但是不知道怎么解决 va_start(cArguments, pFormat); VSPRINTF(pLogContent,pFormat,cArguments); SPRINTF(nn,"%s",pLogContent); IFILE_Write(pFile, pLogContent, STRLEN(pLogContent)); va_end(cArguments); //free the pointer FREEIF(pTime) FREEIF(pLogContent); //cut line. IFILE_Write(pFile, "\r\n----------------\r\n", STRLEN("\r\n----------------\r\n")); return SUCCESS;#endif}