Fread
From SA-MP Wiki
Fread
Read from a file.
(File:handle, string[], size = sizeof string, bool: pack = false)
| handle | The file to read from |
| string | The string to store the read text in, passed by reference |
| size | The number of bytes to read |
| pack | Should 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.
- fwrite: Write to a file.
- fopen: Open a file.
- fclose: Close a file.
- fremove: Remove a file.
