Get PocketC File Handle Int?
I'm now taking a look at the PocketC powerful tool, but there is an fileopen
function, that generates a integer called filehandle
, that is used for most of the File I/O operations of PocketC. How do I use this int filehandle
to call the other file manipulation fu开发者_运维百科nctions?
Here is my example function that I'm using at my program:
fileopen("\test.txt", 0, 0x00000000);
Description of int filehandle
: Integer used for file operations, used as a pointer to the fileopen
instruction.
What do you mean discover the int filehandle
? Your question is very vague.
Do you mean you want this?
int filehandle;
filehandle=fileopen("\test.txt", 0, 0x00000000); //PocketC may not like inline declarations.
The value returned by fileopen
on success will be different each time -- that's the point of returning a handle, to uniquely identify a resource. If it returned the same value each time, you would have no way to distinguish the different files you had opened.
You need to save the value like Earlz suggested and then pass the saved variable to the other file manipulation functions.
According to the documentation, fileopen
RETURNS the filehandle as an int.
fileopen(string filepath, int type, int flag) : open a file in unicode/ascii. You can create a new file or simply open one. Please use the flag correctly. ... Return: Returns an integer as the File Handle if successful,otherwise -1, Remember to keep this handle value somewhere, Because you have to use this handle for the rest of file operations.
精彩评论