Jump to content



Photo
- - - - -

Open Files From Folders In Sd Card - Bfile_openfile()


  • Please log in to reply
5 replies to this topic

#1 neptune45

neptune45

    Casio Fan

  • Members
  • PipPip
  • 44 posts
  • Gender:Male
  • Location:Madrid (Spain)

  • Calculators:
    fx-9860g Slim

Posted 05 November 2008 - 10:17 PM

Hello,

I wonder if someone has found a problem trying to open files from the SD card that are stored in a folder, while programming in C.
I am having this problem while calling function Bfile_OpenFile() in the SDK emulator. I have a fx9860g slim so I do not know if in the real calculator it happens the same or it is just a problem in the emulator.

I have tryed to read files from folders in the storage memory and everything is fine, and also tryed files stored in the root directory of the SD card, and it works.

To put an example, this piece of source code is failing all the time, and the file referred exists:
[codebox] //Variables
int iHandle;
FONTCHARACTER sFont[]={'\\','\\','c','r','d','0','\\','f','o','l','d','e','r','1','\\','f','i','l','e','.','t','x','t',0};

//Open file
iHandle=Bfile_OpenFile(sFont,_OPENMODE_READ);[/codebox]

Variable iHandle is getting -1 everytime.
Does anyone has found this problem?
I am going crazy... :(

Thanks
Diego.

#2 IbmPad

IbmPad

    Casio Fan

  • Members
  • PipPip
  • 35 posts
  • Location:France
  • Interests:- Programming (PC and Calc)<br />- Old calculators<br />- Piano<br />- Foreign languages

  • Calculators:
    CP-330 / FX-9860G SD / HP-49G+ / HP-48G / AFX 2.0+ / FX-795P / FX-4500P / FX-8500G/ FX-4000P / FX-602P / FX-7000G / FX-6800G / FX-702P / PB-700 / Sharp PC-1403 / Электроника МК-61 / TI-57 II / FX-180PV / FX-82 / FX-82D / FX-92

Posted 06 November 2008 - 06:22 PM

Hello,

I think that the \ character is used in C for getting special characters. And to get the \ character you have to put \\.

I'm not sure, but I think it must be :

FONTCHARACTER sFont[]={'\\','\\','c','r','d','0','\\','f','o','l','d','e','r','1','\\','f','i','l','e','.','t','x','t',0};


#3 neptune45

neptune45

    Casio Fan

  • Members
  • PipPip
  • 44 posts
  • Gender:Male
  • Location:Madrid (Spain)

  • Calculators:
    fx-9860g Slim

Posted 07 November 2008 - 02:02 PM

[quote name='IbmPad' post='46203' date='Nov 6 2008, 07:22 PM']Hello,

I think that the \ character is used in C for getting special characters. And to get the \ character you have to put \\.

I'm not sure, but I think it must be :

// ----------------------------------------------------------------// File pathFONTCHARACTER *FilePath(char *sRoot,char *sFolder,                        char *sFile,FONTCHARACTER *sFont){                          //Variables  char sPath[50];    //File path with folder  if(strlen(sFolder)==0)    sprintf(sPath,"\\\\%s\\%s",sRoot,sFile);    //File path without folder  else    sprintf(sPath,"\\\\%s\\%s\\%s",sRoot,sFolder,sFile);    //Convert to FONTCHARACTER  Char2Font(sPath,sFont);  return(sFont);}// ----------------------------------------------------------------// Char string -> Fontcharacter stringFONTCHARACTER *Char2Font(char *sChar, FONTCHARACTER *sFont){  int i=0;  for(i=0;sChar[i]!=0;i++) sFont[i]=sChar[i];  sFont[i]=0;  return(sFont);}

I call FilePath() routine to get the file name and then Bfile_OpenFile() function. And it works when I access file in folders in the storage memory "fls0", but for some reason when I try to access file in folders on the SD card "crd0" it is not working. It works for files in the root directory of the SD card though.

#4 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 08 November 2008 - 05:28 AM

Strange, have you tried perhaps experimenting with different folder names in the SD card?

#5 neptune45

neptune45

    Casio Fan

  • Members
  • PipPip
  • 44 posts
  • Gender:Male
  • Location:Madrid (Spain)

  • Calculators:
    fx-9860g Slim

Posted 08 November 2008 - 11:10 AM

Strange, have you tried perhaps experimenting with different folder names in the SD card?


Yes, I tried several folder names as far as I remember: "folder1", "folder", "fold", "abcdefgh", "folder1 ", with same result.

Today I was reviewing the documentation provided by casio with the SDK and the function to delete folders, Bfile_DeleteDirectory(), states that you cannot delete folders in SD card (and main memory), it is only working for the storage memory. It looks like there is a kind of limitation working with SD card folders. However, unless someone else confirms this problem, we cannot be sure if the problem happens only on the SDK, the real calculator, or even just mi SDK installation on my PC.

I only have the fx9860g slim so I can only test that I see this problem in the SDK.

I am developing a text editor with an integrated file system explorer, that is why I am testing all of this :)

Text editor
Posted Image

Integrated file system explorer:
Posted Image

Edition commands: Clip, copy, cut, paste, del
Posted Image

Search string within text
Posted Image

Inserting special characters into text:
Posted Image

Integrated help:
Posted Image

Setup screen:
Posted Image

Its almost done, but while doing my testings I found out this problem that I am trying to solve.
The main feature, I would say, is that you can edit text in four different fonts, from the standard 21 columns and 8 rows to 32 columns and 10 rows.

I will release after I complete my testing.

Diego.

#6 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 08 November 2008 - 05:45 PM

Sweet! :) That looks pretty awesome.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users