flength

warning

This function starts with lowercase letter.

Description

Returns the length of a file.

NameDescription
handleThe file handle returned by fopen or ftemp

Returns

The length of a file, in bytes.

Examples

// Open "file.txt" in "read only" mode
new File:handle = fopen("file.txt", io_read);
// If "file.txt" is open
if (handle)
{
// Success
// Print the size oin bytes of "file.txt"
printf("File size: %d", flength(handle));
// Close "file.txt"
fclose(handle);
}
else
{
// Error
print("Failed to open \"file.txt\".");
}

Notes

warning

Using an invalid handle will crash your server! Get a valid handle by using fopen or ftemp.

Related Functions