Fread

From SA-MP Wiki

Jump to: navigation, search

Fread


Read from a file.


Parameters:
(File:handle, string[], size = sizeof string, bool: pack = false)
handleThe file to read from
stringThe string to store the read text in, passed by reference
sizeThe number of bytes to read
packShould the string reference be packed?


This function does not return a specific value.


public OnGameModeInit()
{
    new string[64]; // Create the string to store the read text in
    new File:example = fopen("Startup.txt", io_read); // Open the file
    fread(example, string); // Fread from the file and store what's read in 'string'
    fclose(example); // Close the file
    printf("%s",string); // Print what was read
    return 1;
}

Related Functions

The following functions might be useful as well, as they're related to this function in one way or another.

Personal tools