This wiki is out of date, use the continuation of this wiki instead


From FenixWiki

Jump to: navigation, search


[edit] Definition

INT fread ( <INT filehandle> , <VARSPACE data> )

Reads the information from a file loaded with fopen() to a variable.

[edit] Parameters

INT filehandle - The FileHandle of the file returned by fopen().
VARSPACE data - The data to read from the file (any type of variable). It will be loaded into this variable.

[edit] Returns

INT : The number of bytes read from the file.

[edit] Example

Process loadthing(STRING loadpath);
    int handle;   // handle for the loaded file 
    int druppels; // here's where the loaded data go

    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(0,0,0,0,druppels);       // shows the value of druppels


Used in example: fopen(), fclose(), write()

Personal tools