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

Fread

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 02:34, 28 May 2007 (edit)
Woody (Talk | contribs)

← Previous diff
Revision as of 14:17, 29 May 2007 (edit) (undo)
Sandman (Talk | contribs)
m
Next diff →
Line 3: Line 3:
==Definition== ==Definition==
-'''INT''' fread ( <'''INT''' handle> , data )+'''INT''' fread ( <'''INT''' filehandle> , <'''VOID''' data> )
Reads the information from a file loaded with [[fopen]] to a variable. Reads the information from a file loaded with [[fopen]] to a variable.
Line 9: Line 9:
== Parameters == == Parameters ==
{| {|
-| '''INT''' handle || - Identifier of the file loaded with [[fopen]].+| '''INT''' filehandle || - Identifier of the file loaded with [[fopen]].
|- |-
-| data || - The data to read from the file (can be any type of variable that Fenix supports).+| '''VOID''' data || - The data to read from the file (can be any type of variable that Fenix supports).
|} |}
== Returns == == Returns ==
-[[INT]] : The number of bytes read from the file.+'''INT''' : The number of bytes read from the file.
== Example == == Example ==
Line 35: Line 35:
</pre> </pre>
-Used in example: [[fopen]], [[fclose]], [[write_int]]+Used in example: [[fopen]](), [[fclose]](), [[write_int]]()

Revision as of 14:17, 29 May 2007


Contents

Definition

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

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

Parameters

INT filehandle - Identifier of the file loaded with fopen.
VOID data - The data to read from the file (can be any type of variable that Fenix supports).

Returns

INT : The number of bytes read from the file.

Example

Process readthing(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

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

Personal tools