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

Developer

Forums

Forums:

:confused:
The same mif file, the same dll, the same Brew Emulator.Just a simple program like the follow :
void printLog(AEEApplet * pMe, char * fileName, char * content) {

IFileMgr * pIFileMgr; // A IFileMgr type pointer
IFile * pIFile; // A IFile type pointer

if (pMe->m_pIShell == NULL) return;

if ( ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_FILEMGR,(void **)&pIFileMgr))
return ;

SPRINTF(dirName, "%s", fileName);

if ( IFILEMGR_Test(pIFileMgr, dirName) == EFAILED ) {
if ( (pIFile = IFILEMGR_OpenFile(pIFileMgr, dirName, _OFM_CREATE)) == NULL ) {
IFILEMGR_Release(pIFileMgr);
pIFileMgr = NULL;
return;
}
}

else if ( (pIFile = IFILEMGR_OpenFile(pIFileMgr,dirName, _OFM_APPEND)) == NULL ) {
IFILEMGR_Release(pIFileMgr);
pIFileMgr = NULL;
return;
}

if (0 ==IFILE_Write(pIFile,"haha", 4)){
displayOutput(pMe,0, (byte *)"write file failed !!");
}

IFILEMGR_Release(pIFileMgr);
pIFileMgr = NULL;
IFILE_Release(pIFile);
pIFile = NULL;

}

when it run on the Emulator of my computer, it's fine. But in some other's computer, it doesn't work. It can creat a file , but can not write something to this file.I wanna know the possible reasons. Thank you very much!!:p

Did you find out the reason.
I have similar problem here. Same emulator (2.1), same computer, same mif file, same mod file. The problem is with file write. It works when I use Motorola T720, VX4400 and other device files. It does not work when I try VX6000 device file.
Whe I try
written = IFILE_Write(pMe->pIFile, readBuff, rv);
the returned in written is same as rv. But I dont see anythnig in the file. Even after IFILE_Release(pMe->pIFile); the file is empty!
-Vasanth

Did you find out the reason.
I have similar problem here. Same emulator (2.1), same computer, same mif file, same mod file. The problem is with file write. It works when I use Motorola T720, VX4400 and other device files. It does not work when I try VX6000 device file.
Whe I try
written = IFILE_Write(pMe->pIFile, readBuff, rv);
the returned in written is same as rv. But I dont see anythnig in the file. Even after IFILE_Release(pMe->pIFile); the file is empty!
-Vasanth

It works when I use 2.0 emulator!

It works when I use 2.0 emulator!

File reading works great, but writing returns an "access violation" on simulator. It´s weird because I coded exactly as the API says and I took as refference IFILE app from SDK 1.0.
(the code is quite simple to fail)

File reading works great, but writing returns an "access violation" on simulator. It´s weird because I coded exactly as the API says and I took as refference IFILE app from SDK 1.0.
(the code is quite simple to fail)

EFS implementation depends on OEM. Performance and other behavior can greatly vary. In many phones there are problem with IFILE API implementation. Check with your phone spec.
ruben

EFS implementation depends on OEM. Performance and other behavior can greatly vary. In many phones there are problem with IFILE API implementation. Check with your phone spec.
ruben

IFILEMGR_Release(pIFileMgr);
pIFileMgr = NULL;
IFILE_Release(pIFile);
pIFile = NULL;
Try calling IFILEMGR_GetLastError() after the write call. Maybe that will tell you something.
Also, its probably better practice to release the file interface before releasing the file manager interface. I'd be surprised if that was the culprit, but so much is unknown, that with a particular brew version / device combination, you just never know...

IFILEMGR_Release(pIFileMgr);
pIFileMgr = NULL;
IFILE_Release(pIFile);
pIFile = NULL;
Try calling IFILEMGR_GetLastError() after the write call. Maybe that will tell you something.
Also, its probably better practice to release the file interface before releasing the file manager interface. I'd be surprised if that was the culprit, but so much is unknown, that with a particular brew version / device combination, you just never know...

IFile* pIFile = IFILEMGR_OpenFile(pMe->m_pIFileMgr, "xxx.yyy", _OFM_CREATE);
This simple ends with an "Access violation" "memory could not be read" at the simulator, BUT this
IFile* pIFile2 = IFILEMGR_OpenFile(pMe->m_pIFileMgr, "xxx.zzz", _OFM_READ);
just works fine.
which is the logic ? I can´t get it.:mad:

IFile* pIFile = IFILEMGR_OpenFile(pMe->m_pIFileMgr, "xxx.yyy", _OFM_CREATE);
This simple ends with an "Access violation" "memory could not be read" at the simulator, BUT this
IFile* pIFile2 = IFILEMGR_OpenFile(pMe->m_pIFileMgr, "xxx.zzz", _OFM_READ);
just works fine.
which is the logic ? I can´t get it.:mad:

off the IFILEMGR_OpenFile() page in documentation:
_OFM_CREATE: Creates a new file in read/write mode. An error is
generated, and no file opened, if the file already exists.

off the IFILEMGR_OpenFile() page in documentation:
_OFM_CREATE: Creates a new file in read/write mode. An error is
generated, and no file opened, if the file already exists.

File doesn´t exist, I´ve already red that.

File doesn´t exist, I´ve already red that.

Once I faced the same problem. IFile_Open was unsucessful.
I increased "Max Files allowed to create" and "Max space allowed to Write".
And it worked.
-Palchin

Once I faced the same problem. IFile_Open was unsucessful.
I increased "Max Files allowed to create" and "Max space allowed to Write".
And it worked.
-Palchin

Ok, I haven't read all of the previous posts very carefully so maybe the following is off topic ... but I just ran into a problem using version 2.1 of the emulator and the VX6000 device file. File writes were failing with the error: EFILEEXISTS (as given by IFILEMGR_GetLastError). Now, my code works fine with the emulator and the Z800 device file, and (more importantly) on the VX6000 itself. If it's possible, I'd say that somehow the VX6000 device file is messing something up.
Paul
p.s., I opened the file with the mode: _OFM_READWRITE (so I'll assume that it's kosher to write to it).

Ok, I haven't read all of the previous posts very carefully so maybe the following is off topic ... but I just ran into a problem using version 2.1 of the emulator and the VX6000 device file. File writes were failing with the error: EFILEEXISTS (as given by IFILEMGR_GetLastError). Now, my code works fine with the emulator and the Z800 device file, and (more importantly) on the VX6000 itself. If it's possible, I'd say that somehow the VX6000 device file is messing something up.
Paul
p.s., I opened the file with the mode: _OFM_READWRITE (so I'll assume that it's kosher to write to it).

are you using the dll from the same place where you have compiled?
Move it to a different directory like c:\build\ and try from there.
-Vasanth

are you using the dll from the same place where you have compiled?
Move it to a different directory like c:\build\ and try from there.
-Vasanth

Quote:Originally posted by vasanths
are you using the dll from the same place where you have compiled? -Vasanth No, it (the app's dll) is in a different directory then the directory in which it was compiled/built. Just out of curiousity, is there a reason that you thought that that would have an effect?
Paul

Quote:Originally posted by vasanths
are you using the dll from the same place where you have compiled? -Vasanth No, it (the app's dll) is in a different directory then the directory in which it was compiled/built. Just out of curiousity, is there a reason that you thought that that would have an effect?
Paul

In my case, it was counting all the .o and other junk that was in my directory. When I moved the dll to a different dir it started working.

In my case, it was counting all the .o and other junk that was in my directory. When I moved the dll to a different dir it started working.

Acutally I got the similar problem as you guys mentioned above.
After ISHELL_CreateInstance() creates an IFileMgr object successfully, I can use IFILEMGR_OpenFile() only with parameter "_OFM_READ". But it returns a failure if I call IFILEMGR_OpenFile() with "_OFM_CREATE" or "_OFM_READWRITE". Of course I am sure there is no file which has the file-name I specified. The following is part of my code.
////////////////////////////////////////////////////
if (ISHELL_CreateInstance(pme->a.m_pIShell, AEECLSID_FILEMGR, (void **)&pIFileMgr))
FREE(pszBuf);
pInFile = IFILEMGR_OpenFile(pIFileMgr, pszBuf, _OFM_READ);
pszBuf = "test.raw";
pOutFile = IFILEMGR_OpenFile(pIFileMgr, pszBuf, _OFM_CREATE);
////////////////////////////////////////////////////
The error occurs at the last line as I described above. Is there any possible mistake I can make?
Thank you.
Joni

Acutally I got the similar problem as you guys mentioned above.
After ISHELL_CreateInstance() creates an IFileMgr object successfully, I can use IFILEMGR_OpenFile() only with parameter "_OFM_READ". But it returns a failure if I call IFILEMGR_OpenFile() with "_OFM_CREATE" or "_OFM_READWRITE". Of course I am sure there is no file which has the file-name I specified. The following is part of my code.
////////////////////////////////////////////////////
if (ISHELL_CreateInstance(pme->a.m_pIShell, AEECLSID_FILEMGR, (void **)&pIFileMgr))
FREE(pszBuf);
pInFile = IFILEMGR_OpenFile(pIFileMgr, pszBuf, _OFM_READ);
pszBuf = "test.raw";
pOutFile = IFILEMGR_OpenFile(pIFileMgr, pszBuf, _OFM_CREATE);
////////////////////////////////////////////////////
The error occurs at the last line as I described above. Is there any possible mistake I can make?
Thank you.
Joni

What does IFILEMGR_GetLastError returns for you?
ruben

What does IFILEMGR_GetLastError returns for you?
ruben

It returns "Bad file name" (error 259).
But is there any problem witn my naming?
Thank you
Joni

It returns "Bad file name" (error 259).
But is there any problem witn my naming?
Thank you
Joni

I had a similar problem. The emulator did not like opening files marked as read only. THe problem would show up when someone else checked the code out of source control (that included that file), and thus got a read only version of the file.

I had a similar problem. The emulator did not like opening files marked as read only. THe problem would show up when someone else checked the code out of source control (that included that file), and thus got a read only version of the file.

If you are seeing this problem in emulator, try modifying the file information in your emulator using device configurator, see if that solves the immediate problem in emulator.
Please note that EFS implementation in BREW depends on OEM. In many phone there are problems with EFS.
ruben

If you are seeing this problem in emulator, try modifying the file information in your emulator using device configurator, see if that solves the immediate problem in emulator.
Please note that EFS implementation in BREW depends on OEM. In many phone there are problems with EFS.
ruben

I've solved my problem now.
I just forgot a very basic issue --- AEE privilege level.
Maybe some of you who have IFILE/IFILEMGR problems should check the privilege level of your application again, and make sure it has the privilege to do file I/O.
Btw, the privilege setting can be changed at mif editor (under General tag)
Joni

I've solved my problem now.
I just forgot a very basic issue --- AEE privilege level.
Maybe some of you who have IFILE/IFILEMGR problems should check the privilege level of your application again, and make sure it has the privilege to do file I/O.
Btw, the privilege setting can be changed at mif editor (under General tag)
Joni

Jonichen: You need to make sure that the file privilege level has been set in your application's .mif file. To do this, open the .mif file, click on the "General" tab, and then click the checkbox for "File" privileges.

Jonichen: You need to make sure that the file privilege level has been set in your application's .mif file. To do this, open the .mif file, click on the "General" tab, and then click the checkbox for "File" privileges.

Thank you
I just found this problem right after my previous post :)
Joni

Thank you
I just found this problem right after my previous post :)
Joni