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.
Open Files From Folders In Sd Card - Bfile_openfile()
Started by
neptune45
, Nov 05 2008 10:17 PM
5 replies to this topic
#1
Posted 05 November 2008 - 10:17 PM
#2
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 :
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
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 :
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.
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
Posted 08 November 2008 - 05:28 AM
Strange, have you tried perhaps experimenting with different folder names in the SD card?
#5
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
Integrated file system explorer:
Edition commands: Clip, copy, cut, paste, del
Search string within text
Inserting special characters into text:
Integrated help:
Setup screen:
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
Posted 08 November 2008 - 05:45 PM
Sweet! That looks pretty awesome.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users