Fclose

From SA-MP Wiki

Jump to: navigation, search
Closes a file (stop reading/writing).


Parameters:
(File: handle)
File:handleThe file handle to close.


Returnstrue (1) on success false (0) on failure.


Image:32px-Circle-style-warning.png Important Note: The file handle must be valid, and must point to a file successfully opened by fopen.


new File:example = fopen("Hello.txt", io_append); // Open 'Hello.txt' in the scriptfiles directory
if(example == true) // Check that it was successfully opened
{
    fwrite(example, "Hi there!"); // Write in the file
    fclose(example); // Close it
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

Personal tools