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

Developer

Forums

Forums:

I want to create a text file in my project directory.
Is it the right way to do that.
When i compiled it,its not giving any error.
but simulator is throwing some access violation error.
i have set privilage for file access in MIF .

ISHELL_CreateInstance(pMe->pIShell, AEECLSID_FILEMGR,
(void**)(&pMe->m_pIFileMgr)) ;

pMe->nIFile = IFILEMGR_OpenFile(pMe->m_pIFileMgr, "Test.txt", _OFM_READ);

I want to create a text file in my project directory.
Is it the right way to do that.
When i compiled it,its not giving any error.
but simulator is throwing some access violation error.
i have set privilage for file access in MIF .
ISHELL_CreateInstance(pMe->pIShell, AEECLSID_FILEMGR,
(void**)(&pMe->m_pIFileMgr)) ;
pMe->nIFile = IFILEMGR_OpenFile(pMe->m_pIFileMgr, "Test.txt", _OFM_READ);
please help

I want to create a text file in my project directory.
Is it the right way to do that.
When i compiled it,its not giving any error.
but simulator is throwing some access violation error.
i have set privilage for file access in MIF .
ISHELL_CreateInstance(pMe->pIShell, AEECLSID_FILEMGR,
(void**)(&pMe->m_pIFileMgr)) ;
pMe->nIFile = IFILEMGR_OpenFile(pMe->m_pIFileMgr, "Test.txt", _OFM_READ);
please help

Hi niju_nm,
Use IFILEMGR_GetLastError.
It would give you the error code if the last operation is unsuccessful.

Hi niju_nm,
Use IFILEMGR_GetLastError.
It would give you the error code if the last operation is unsuccessful.

Maybe the MIF should be system

Maybe the MIF should be system

niju_nm wrote:I want to create a text file in my project directory.
Is it the right way to do that.
When i compiled it,its not giving any error.
but simulator is throwing some access violation error.
i have set privilage for file access in MIF .
ISHELL_CreateInstance(pMe->pIShell, AEECLSID_FILEMGR,
(void**)(&pMe->m_pIFileMgr)) ;
pMe->nIFile = IFILEMGR_OpenFile(pMe->m_pIFileMgr, "Test.txt", _OFM_READ);
i wonder if ur filemgr instance is created check it before using it...
do check the return value for create instance!!

niju_nm wrote:I want to create a text file in my project directory.
Is it the right way to do that.
When i compiled it,its not giving any error.
but simulator is throwing some access violation error.
i have set privilage for file access in MIF .
ISHELL_CreateInstance(pMe->pIShell, AEECLSID_FILEMGR,
(void**)(&pMe->m_pIFileMgr)) ;
pMe->nIFile = IFILEMGR_OpenFile(pMe->m_pIFileMgr, "Test.txt", _OFM_READ);
i wonder if ur filemgr instance is created check it before using it...
do check the return value for create instance!!

Thank you for all your helps
/////////////////////////////////////////////////////////////////////////
ISHELL_CreateInstance(pMe->pIShell, AEECLSID_FILEMGR,
(void**)(&pMe->m_pIFileMgr)) ;
// Open the file.
pMe->nIFile = IFILEMGR_OpenFile(pMe->m_pIFileMgr, "fs:/~/splash.txt", _OFM_CREATE);
///////////////////////////////////////////////////////////////////
While i am debugging the code , the first line of code is throwing this error
"Unhandled exception at 0x02cf2695 (Brewex.dll) in BREW_Simulator: 0xC0000005: Access violation reading location 0x00000000."
Could anyone please tell what will be the reason for this.

Thank you for all your helps
/////////////////////////////////////////////////////////////////////////
ISHELL_CreateInstance(pMe->pIShell, AEECLSID_FILEMGR,
(void**)(&pMe->m_pIFileMgr)) ;
// Open the file.
pMe->nIFile = IFILEMGR_OpenFile(pMe->m_pIFileMgr, "fs:/~/splash.txt", _OFM_CREATE);
///////////////////////////////////////////////////////////////////
While i am debugging the code , the first line of code is throwing this error
"Unhandled exception at 0x02cf2695 (Brewex.dll) in BREW_Simulator: 0xC0000005: Access violation reading location 0x00000000."
Could anyone please tell what will be the reason for this.

Hi in createinstance use pMe->a.m_pIShell.
U are using m_PIShell replace that with pMe->a.m_pIShell.
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_FILEMGR, (void **)&pMe->pIFileMgr
i think this should solve ur problem

Hi in createinstance use pMe->a.m_pIShell.
U are using m_PIShell replace that with pMe->a.m_pIShell.
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_FILEMGR, (void **)&pMe->pIFileMgr
i think this should solve ur problem

error is solved but the createinstance API is returning a '0' value :(

error is solved but the createinstance API is returning a '0' value :(

try one or all of the following, it will solve your issue.
1. Delete and re-create your MIF file with proper version of MIF Editor.
2. Check if the file "Test.txt" is being used by some other program.
3. Delete the file "Test.txt" manually and re-create it.
thanks,
Shivendra

try one or all of the following, it will solve your issue.
1. Delete and re-create your MIF file with proper version of MIF Editor.
2. Check if the file "Test.txt" is being used by some other program.
3. Delete the file "Test.txt" manually and re-create it.
thanks,
Shivendra

Hi
yes the SUCCESS is defined as a macro like
#define SUCCESS 0
that's why it is returning 0 on success
test the code like this
if(ISHELL_CreateInstance(pMe->pIShell,AEECLSID_FILEMGR(void**)&pMe->pIFileMgr)==SUCCESS)
{
//proceed here

Hi
yes the SUCCESS is defined as a macro like
#define SUCCESS 0
that's why it is returning 0 on success
test the code like this
if(ISHELL_CreateInstance(pMe->pIShell,AEECLSID_FILEMGR(void**)&pMe->pIFileMgr)==SUCCESS)
{
//proceed here

I want to create a file inside my application folder ,which is in sdk/example directory.
For this i craeted a new application from application wizard by giving all previleges .
And added the above mentioned code ,but its not creating the file at all and when i am opening the application in simulator its giving message like "Disabled:the application is disabled would u like to restore it ....... " .
Plz suggest me how to solve this.
Thank you for all ur support.

I want to create a file inside my application folder ,which is in sdk/example directory.
For this i craeted a new application from application wizard by giving all previleges .
And added the above mentioned code ,but its not creating the file at all and when i am opening the application in simulator its giving message like "Disabled:the application is disabled would u like to restore it ....... " .
Plz suggest me how to solve this.
Thank you for all ur support.

IFile *pIfile=NULL;
if (ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_FILEMGR, (void **)&pMe->pIFileMgr) != SUCCESS)
{
pMe->pIFileMgr = NULL;
return FALSE;
}
// to open a file.
pIfile=IFILEMGR_OpenFile(pMe->pIFileMgr,"filename.txt",_OFM_CREATE);
The above code will create a file in the current path of the project where it is stored. For eg in ur case u saved ur project in example folder (C:\Program Files\BREW 3.1.5\sdk\examples\myfirstapp)so it will create a file in that particula path. myfirstapp is the name of the project.
Try giving only filename.txt in open file command.

IFile *pIfile=NULL;
if (ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_FILEMGR, (void **)&pMe->pIFileMgr) != SUCCESS)
{
pMe->pIFileMgr = NULL;
return FALSE;
}
// to open a file.
pIfile=IFILEMGR_OpenFile(pMe->pIFileMgr,"filename.txt",_OFM_CREATE);
The above code will create a file in the current path of the project where it is stored. For eg in ur case u saved ur project in example folder (C:\Program Files\BREW 3.1.5\sdk\examples\myfirstapp)so it will create a file in that particula path. myfirstapp is the name of the project.
Try giving only filename.txt in open file command.

Thank u all ,my problem get solved

Thank u all ,my problem get solved

rajeshwari wrote:IFile *pIfile=NULL;
if (ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_FILEMGR, (void **)&pMe->pIFileMgr) != SUCCESS)
{
pMe->pIFileMgr = NULL;
return FALSE;
}
// to open a file.
pIfile=IFILEMGR_OpenFile(pMe->pIFileMgr,"filename.txt",_OFM_CREATE);
The above code will create a file in the current path of the project where it is stored. For eg in ur case u saved ur project in example folder (C:\Program Files\BREW 3.1.5\sdk\examples\myfirstapp)so it will create a file in that particula path. myfirstapp is the name of the project.
Try giving only filename.txt in open file command.
Some correction: file may already exist in app folder, and must be re-created:
pIfile=IFILEMGR_OpenFile(pMe->pIFileMgr,"filename.txt",_OFM_CREATE);
if ((pIfile==NULL)&&(IFILEMGR_GetLastError(pMe->pIFileMgr)==EFILEEXISTS)) { pIfile=IFILEMGR_OpenFile(pMe->pIFileMgr,"filename.txt",_OFM_READWRITE); IFILE_Truncate(pIfile,0); }

rajeshwari wrote:IFile *pIfile=NULL;
if (ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_FILEMGR, (void **)&pMe->pIFileMgr) != SUCCESS)
{
pMe->pIFileMgr = NULL;
return FALSE;
}
// to open a file.
pIfile=IFILEMGR_OpenFile(pMe->pIFileMgr,"filename.txt",_OFM_CREATE);
The above code will create a file in the current path of the project where it is stored. For eg in ur case u saved ur project in example folder (C:\Program Files\BREW 3.1.5\sdk\examples\myfirstapp)so it will create a file in that particula path. myfirstapp is the name of the project.
Try giving only filename.txt in open file command.
Some correction: file may already exist in app folder, and must be re-created:
pIfile=IFILEMGR_OpenFile(pMe->pIFileMgr,"filename.txt",_OFM_CREATE);
if ((pIfile==NULL)&&(IFILEMGR_GetLastError(pMe->pIFileMgr)==EFILEEXISTS)) { pIfile=IFILEMGR_OpenFile(pMe->pIFileMgr,"filename.txt",_OFM_READWRITE); IFILE_Truncate(pIfile,0); }