Hi.
This code example is supposed to create a file, fill it, close and open once again for reading.
The file is opened for reading normally. But the next function, Bfile_GetFileSize, always returns -2, i.e. IML_FILEERR_ILLEGALPARAM. It must mean the file handle to be illegal.
FONTCHARACTER fname_s[]={'\\', '\\', 'f', 'l', 's', '0', '\\', 'F', 'N', '.', 'e', 'x', 't', 0};
int AddIn_main(int isAppli, unsigned short OptionNum)
{
int f, i;//File handle and loop variable.
int _DataSize=0;
char g=27; //Random choice. This number is written to a file.
unsigned int key;
Bdisp_AllClr_DDVRAM();
Bfile_DeleteFile(fname_s);
Bfile_CreateFile(fname_s, 50);
if(f=Bfile_OpenFile(fname_s, _OPENMODE_WRITE)<0)
{
Bfile_CloseFile(f);
return 0;
}
for(i=0; i<50;i++)
{
Bfile_WriteFile(f, &g, sizeof(char));
}
if(Bfile_CloseFile(f)<0)
{
return 0;
}
//
if(f=Bfile_OpenFile(fname_s, _OPENMODE_READ)<0)
{
Bfile_CloseFile(f);
return 0;
}
_DataSize=Bfile_GetFileSize(f); //It returns -2.
if(_DataSize<0)
{
//So this block
Bfile_CloseFile(f);
return 0;
}
Bfile_CloseFile(f);
return 1;
}
Casio Fx-9860GII, Building by Casio Fx-9860G SDK.
Thanks.


