OpenFile | developer.brewmp.com OpenFile | developer.brewmp.com

Developer

OpenFile

Forums:

Hi

I have the following code:

if (ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_FILEMGR, (void **)(&pFileMgr))
== AEE_SUCCESS) {

if (IFILEMGR_Test(pFileMgr, LOGFILE) != AEE_SUCCESS) {
pFile = IFILEMGR_OpenFile(pFileMgr, "mytext.txt", _OFM_CREATE);
}
else {
pFile = IFILEMGR_OpenFile(pFileMgr, "mytext.txt", _OFM_APPEND);
}

if (pFile != NULL) {
IFILE_Write(pFile, nText, sizeof(nText));
IFILE_Release( pFile );
}
IFILEMGR_Release( pFileMgr );
}

The pFileMgr is created correctly but the file isn't created. I can't understand the problem here. It should just create a file in the same directory as the program.

Anybody have a tip?

Thanks!

have u given the file priviliges in the MIF??
also give some value in the EFS restriction for MAX files and MAX space....................

have u given the file priviliges in the MIF??
also give some value in the EFS restriction for MAX files and MAX space....................

Check for the last error occured using IFILEMGR_GetLastError() API.
Also check the directory should not be write protected.
BR,
Mitesh

Check for the last error occured using IFILEMGR_GetLastError() API.
Also check the directory should not be write protected.
BR,
Mitesh

Hi,
If u see the IFileMgr interface discription, u have to give "fs:/~/mytext.txt" (AEEFS_HOME_DIR) in the function IFILEMGR_OpenFile inorder to create the file in the same working directory of the project.
So in ur example pFile = IFILEMGR_OpenFile(pFileMgr, "fs:/~/mytext.txt", _OFM_CREATE); has to be given to create the file and similarly for appending/read/write.
Thanks n Regards
Patnaik

Hi,
If u see the IFileMgr interface discription, u have to give "fs:/~/mytext.txt" (AEEFS_HOME_DIR) in the function IFILEMGR_OpenFile inorder to create the file in the same working directory of the project.
So in ur example pFile = IFILEMGR_OpenFile(pFileMgr, "fs:/~/mytext.txt", _OFM_CREATE); has to be given to create the file and similarly for appending/read/write.
Thanks n Regards
Patnaik

Ok, but i have a simple application in VisualStudio and tries to open a file. But I cant get it to work!! This time I try the READ-flag. The pointer is NULL always! Is there any special settings in the project or what?
Need an answer.
Thanks!

Ok, but i have a simple application in VisualStudio and tries to open a file. But I cant get it to work!! This time I try the READ-flag. The pointer is NULL always! Is there any special settings in the project or what?
Need an answer.
Thanks!

use IFILEMGR_GetLastError and check the return value so that the problem can be tracked...post the error no.

use IFILEMGR_GetLastError and check the return value so that the problem can be tracked...post the error no.

Hi,
Check if u have given the support (in Privillage) for File in the QMIF file (check it with the MIF editor).
I have written an applicaton (file handling) which works very fine. I din't face any problem.
ISHELL_CreateInstance( pIShell, AEECLSID_FILEMGR,(void **)&pAppObj->pFileManager)
and then if it is successfull, then
pAppObj->pFileHandle = (IFile *)IFILEMGR_OpenFile(pAppObj->pFileManager, "fs:/~/test3.abc", _OFM_READ);
if (pAppObj->pFileHandle == NULL)
{
return EFAILED;

nReadBytes = IFILE_Read(pAppObj->pFileHandle,(char *)cReadByte, 1024);
in my case every thing works fine, i could able to read if from the file.
Check in the MIF file !!!(i wud suggest to start with select all the check boxes in the privileges section (in mif file) to be safe side :-) )
Rgds
Patnaik

Hi,
Check if u have given the support (in Privillage) for File in the QMIF file (check it with the MIF editor).
I have written an applicaton (file handling) which works very fine. I din't face any problem.
ISHELL_CreateInstance( pIShell, AEECLSID_FILEMGR,(void **)&pAppObj->pFileManager)
and then if it is successfull, then
pAppObj->pFileHandle = (IFile *)IFILEMGR_OpenFile(pAppObj->pFileManager, "fs:/~/test3.abc", _OFM_READ);
if (pAppObj->pFileHandle == NULL)
{
return EFAILED;

nReadBytes = IFILE_Read(pAppObj->pFileHandle,(char *)cReadByte, 1024);
in my case every thing works fine, i could able to read if from the file.
Check in the MIF file !!!(i wud suggest to start with select all the check boxes in the privileges section (in mif file) to be safe side :-) )
Rgds
Patnaik