Omnimaga
Calculator Community => Casio Calculators => Topic started by: Ashbad on September 03, 2011, 04:52:59 pm
-
A few questions regarding how to use some of the functions declared in the fxcg-10/20's version of "stdio.h":
Bfile_OpenFile_OS seems rather awkward for many reasons: first off, why does it need a pointer to a string of unsigned shorts? Is this for 2 byte character sets? It compiles fine with a pointer to a string of chars, (of course it throws a warning, but no error) but do I need to manually input byte sequences to access non-ASCII characters (that was worded bad, but basically, do I need to input different characters to represent the same ones if this parameter is not meant for ASCII characters)?
Secondly, files have to start with "\\fls0\" -- though PrizmWiki doesn't tell how the rest of the file extension has to be represented. Is "\\fls0\city.pcc" as valid extension?
Thirdly, for Bfile_CreateEntry_OS, what type of modes are available (apparently I should use mode (int) 1, but are there other options?) and what do they do? Why in god's name do we need to pass the parameter for size as a pointer to the int that holds the size value? How do you specify where to save it?
For those interested, here's a snippet of code dealing with it (from my contest entry, but I snipped out everything not in question with a "...":
int SAVE_HANDLE = Bfile_OpenFile_OS("\\fls0\city.pcc", 0x03);
if(SAVE_HANDLE < 0) {
...
Bfile_CreateEntry_OS("city.pcc", 1, size_needed);
} else { ... }
-
bump.
-
You could take a look at casios manuals for there fx-9860 SDK (which can be found here: http://edu.casio.com/dl/ (http://edu.casio.com/dl/) under fx-9860 SDk). The Bfile-functions seem to be similar on both calcs, maybe this will help. I dont have a prizm, so these infos build on the similarity of the two platforms.
As for your questions:
1. As far as I understand, there can be two-byte chars, at least for displaying. These would look as described in the character set pdf from these manuals.
2. The manual gives this example: PathName[]={'¥¥','¥¥','f','l','s','0','¥¥','f','i','l','e','n','a','m','e','.','e','x','t',0}; So yes, yours seem to be right.
3. On the old fx, the mode option can be used to create a directory (mode = 5).
I think it being a pointer to an int is a mistake. In the syscall-documentation of simlo is no pointer but a single int.
For where to save it: I think you have to specify the whole path (as in the example above).
-
Stoop!
Not [inset two yen symbols] but '\\'
-
yes, i know, but i was refering to the manual and unwilling to replace them :P
-
I think I now realize what's wrong, after I saw GCC didn't know what escape sequence '\c' was...
Since the "\\fls0\" isn't escaped, it's not represented right. It should be "\\\\fls0\\" instead. Found the error :)
EDIT: nope, still non-working :/
-
If Bfile_OpenFile_OS and Bfile_CreateEntry_OS, which you use, are based on the corresponding syscalls, you have to use a short array to pass the filename.
You could use
syscall 0x1DDC: void Bfile_StrToName_ncpy( unsigned short*dest, const unsigned char*source, int n );
to copy a string constant into a short array.
Refer to fx_calculators_SuperH_based_10.chm: the BFile syscall section for details.
I am surprised, that the compiler does not complain about:
Bfile_OpenFile_OS("\\\\fls0\\city.pcc", 0x03);
-
Awesome! It works now! thanks :D