Jump to content

- - - - -

Bfile_FindFirst - Printing filenames

fx-9860g sdk bfile file

  • Please log in to reply
2 replies to this topic

#1 Raresh Nistor

Raresh Nistor


  • Members
  • Pip
  • 5 posts
  • Gender:Male
  • Location:Middle Earth
  • Interests:* Software Development
    * Design and Photography
    * Linguistics

  • Calculators:
    * CASIO fx-9750GII MkII

Posted 01 March 2019 - 01:59 AM

I'm working on a project which involves loading files from either Storage Memory (\\fls0\) or an SD Card (\\crd0\).


I've been trying to list the root directory of the flash, but it doesn't quite work right, to say the least. Here's what I'm trying to do and the calculator output:


locate(1, 1);
Print("SD Card");

Bfile_FindFirst(flashPath, &fileSearchHandle, fileSearchPath, fileSearchInfo);

for (i = 0; i < 8; i++) {
    locate(2, 2 + i);
    if (!Bfile_FindNext(fileSearchHandle, fileSearchPath, fileSearchInfo))




So far, my reasoning leads me to think that FONTCHARACTER (which according to VSCode, is an unsigned short) is not interchangable to a simple unsigned char pointer the Print method uses. I've tried to see if that's the case by trying to implement a quick and dirty FONTCHARACTER to char* converter, which to say the least... it doesn't work.

void fc2str(FONTCHARACTER* fc, unsigned char* str) {
    FONTCHARACTER* inChar = fc;
    unsigned char* outChar = str;
    do {
        *outChar = (unsigned char)*inChar;
        inChar++; outChar++;
    } while (*outChar != '\0');

It has exactly the same output. 'f', 'f', 'f' etc.


I've tried to look all across the forum (and the internet) for a way to print filenames from Bfile_FindWhatever, but it came out dry.


The primary goal by the end is to have something looking similar to the built-in memory management software.



Memory Management, for comparison.

#2 GodOfCows


    Casio Addict

  • Members
  • PipPipPip
  • 79 posts
  • Gender:Male

  • Calculators:
    fx-9860gii, fx-9750gii, TI-92, TI-89, TI-83 Plus

Posted 01 March 2019 - 04:00 PM

I can't seem to see your output for some reason, but you are right that char (8-bit) and short (I believe it's either 16-bit or 32-bit for this calc) cannot be easily interchanged without possibly losing information





If you could, it be nice if you posted your entire code, it would be much easier to figure out the problem.


Also, I suggest using while do instead of do while, as you may actually read out of the string.


(P.S, it is good workout to solve a problem like this, but if you didn't know there is already a in memory management software made by the community)

#3 sentaro21


    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860GII-2 SD
    HP 50G
    TI-Nspire CX CAS

Posted 02 March 2019 - 02:34 AM

@Raresh Nistor
This is wrong in fc2str.
 } while (*outChar != '\0');
Please correct this way.
 } while (*inChar != '\0');
This add-in  became a good reference for C.Basic's file process.
I believe this program will be of your help. :)

Also tagged with one or more of these keywords: fx-9860g, sdk, bfile, file

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users