Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

hi can u plz tell me prob with this code..new file is not generated every time when this fun is invoked..bt if i tries to append it ,it will work propperly...

void File_fun_budy(mitocs * pMe, unsigned char* temp)
{
IFile * fi=NULL;

//unsigned char data[1000000] = {} ;
char * File_Data = NULL;
int j=0;
IFile *file = NULL;
AECHAR a1[6] ={'d','o','n','e','\0'};

ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_FILEMGR,(void **)&pMe->pIFileMgr);
IFILEMGR_Remove(pMe->pIFileMgr, HANDLING_LOG_FILES);
file =
IFILEMGR_OpenFile(pMe->pIFileMgr, HANDLING_LOG_FILES,_OFM_CREATE);

if (NULL == file)
{
// attempt to create the file
file =
IFILEMGR_OpenFile(pMe->pIFileMgr, HANDLING_LOG_FILES, _OFM_CREATE);
}

if (file)
{

// Close the file,fff flushing any in-memory buffers. Prevents lossage of
// this log line due to crashes immediately following logging.

IFILE_Write(file,temp,250);

IFILE_Release(file);

}

}

If IFILEMGR_OpenFile() is called with _OFM_READWRITE or _OFM_APPEND, NULL is returned if the file does not exist. An open mode of _OFM_CREATE will return an error if the file already exists; call IFILEMGR_Remove() to remove a file, then create it with IFILEMGR_OpenFile() with the _OFM_CREATE mode.
From the docs for IFILEMGR_OpenFile.

If IFILEMGR_OpenFile() is called with _OFM_READWRITE or _OFM_APPEND, NULL is returned if the file does not exist. An open mode of _OFM_CREATE will return an error if the file already exists; call IFILEMGR_Remove() to remove a file, then create it with IFILEMGR_OpenFile() with the _OFM_CREATE mode.
From the docs for IFILEMGR_OpenFile.

Actually sir if u can giv good look to code he is using remove ,so file creation should happen..check out budy if u hav nt opened file some where else n still trying to remove it..tht cld be only prob ..i thinkkkkkkkkk
els i shld think better
ashu

Actually sir if u can giv good look to code he is using remove ,so file creation should happen..check out budy if u hav nt opened file some where else n still trying to remove it..tht cld be only prob ..i thinkkkkkkkkk
els i shld think better
ashu

what's the name of the file you are trying to create - the value of HANDLING_LOG_FILES?
are there a lot of files created already (some devices have a limit on how many files there might be in your application's directory, for example)

what's the name of the file you are trying to create - the value of HANDLING_LOG_FILES?
are there a lot of files created already (some devices have a limit on how many files there might be in your application's directory, for example)

4 to 5 files will be there

4 to 5 files will be there