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

Fwrite

From FenixWiki

Jump to: navigation, search


Contents

[edit] Definition

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

Writes data to a file loaded with fopen.

[edit] Parameters

INT filehandle - Identifier of the file loaded with fopen.
VARSPACE data - The data to write to the file (any type of variable).

[edit] Returns

INT : The number of bytes written to the file.

[edit] Example

Process writething(STRING loadpath);
Private
    handle;   // handle for the loaded file 
    druppels; // the data to write to the file

Begin

    druppels=rand(1,10);

    handle=fopen(loadpath,O_WRITE); // opens the file in writing mode
    fwrite(handle,druppels);        // writes the druppels variable to the file
    fclose(handle);                 // zipping up after business is done

End

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

Personal tools