- This wiki is out of date, use the continuation of this wiki instead
Fopen
From FenixWiki
(Difference between revisions)
| Revision as of 02:09, 28 May 2007 (edit) Woody (Talk | contribs) ← Previous diff |
Revision as of 02:25, 28 May 2007 (edit) (undo) Woody (Talk | contribs) Next diff → |
||
| Line 31: | Line 31: | ||
| Begin | Begin | ||
| - | handle=fopen(loadpath,O_READ); | + | handle=fopen(loadpath,O_READ); // opens the file in reading mode |
| - | fread(handle,druppels); | + | fread(handle,druppels); // reads from the file and puts the data in druppels |
| - | fclose(handle); | + | fclose(handle); // zipping up after business is done |
| - | write_int(0,160,100,4,&druppels); | + | write_int(0,160,100,4,&druppels); // let's see what we got here |
| End | End | ||
Revision as of 02:25, 28 May 2007
Contents |
Definition
INT fopen ( <STRING path> , <INT mode> )
Opens a file on the hard drive for reading or writing.
Parameters
| STRING path | - The path to the file you wish to open for reading/writing. |
| INT mode | - The mode with which to access the file (see Readwrite_modes). |
Returns
INT : Handle
| -1 | - Could not load? |
| !-1 | - The identifier of the file now opened for reading/writing. |
Example
Process loadthing(STRING loadpath);
Private
handle; // handle for the loaded file
druppels; // here's where the loaded data go
Begin
handle=fopen(loadpath,O_READ); // opens the file in reading mode
fread(handle,druppels); // reads from the file and puts the data in druppels
fclose(handle); // zipping up after business is done
write_int(0,160,100,4,&druppels); // let's see what we got here
End
