What should Bfile_SeekFile_OS be renamed to?
Other, please comment on why.
 0%  [ 0 ]
Bfile_GetPos_OS
 0%  [ 0 ]
Bfile_TellFile_OS
 100%  [ 2 ]
Total Votes : 2

So, I wrote a large part of the file system tutorial on WikiPrizm. I am finally testing out the functions for the Bfile (MCS functions are easy and were tested before posting) and have found an issue. Here is my research on it:

Page 34 in the fx-9860G Libraries PDF says that Bfile_SeekFile "moves the file pointer of an open file." It has the definition of int Bfile_SeekFile(int HANDLE, int pos);

Running this test code, the expected data in the file should be "Hello World!", but instead reads "Hello People\0World!":
Code:
#define STR "Hello People"
 // hFile is a valid handle to a file
 Bfile_WriteFile_OS(hFile, STR, sizeof(STR)); // Succeeds, returns 13
 Bfile_SeekFile_OS(hFile, 6); // Succeeds, returns 13
 Bfile_WriteFile_OS(hFile, "World!", 7); // Succeeds, returns 7


From testing, Bfile_SeekFile_OS ignores the second parameter and simply returns the current position in the file, just like ftell works:

Code:

 // hFile is a new handle
 Bfile_SeekFile_OS(hFile, 0); // Returns 0
 Bfile_WriteFile_OS(hFile, STR, sizeof(STR));
 Bfile_SeekFile_OS(hFile, 0); // Returns 13
 Bfile_WriteFile_OS(hFile, "World!", 7);
 Bfile_SeekFile_OS(hFile, 0); // Returns 20


I believe that Casio replaced SeekFile/fseek with TellFile/ftell. If you want to seek, you must use syscall 0x1DA9 according to Simon Lother (He also commented on this on an omnimaga post here: http://ourl.ca/820785 this was actually the first google result for bfile_seekfile_os)
AHelper wrote:
I believe that Casio replaced SeekFile/fseek with TellFile/ftell.
Then why rename it Bfile_GetPos_OS? Why not BFile_TellFile_OS?
Where does the name Bfile_GetPos_OS come from? If that's a function name from the 9860 libraries I'd say go with that, otherwise I prefer a more conventional name such as Bfile_Tell.
Simon used that name in his post. I put it up since that post was used (I linked to it) for some time and it may be in his chm.
Tari wrote:
Where does the name Bfile_GetPos_OS come from? If that's a function name from the 9860 libraries I'd say go with that, otherwise I prefer a more conventional name such as Bfile_Tell.
Actually, yes, we should get rid of all the File_OS crap. Just Bfile_Tell and Bfile_Seek and Bfile_Write.
Tari wrote:
Where does the name Bfile_GetPos_OS come from? If that's a function name from the 9860 libraries I'd say go with that, otherwise I prefer a more conventional name such as Bfile_Tell.
I strongly support this proposal. A lot of the current syscall names are needlessly convoluted and needlessly far from their libc equivalents.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement