filesize()

filesize()#

filesize() returns the size of a file in bytes by using the stat() system call.

Prototype

off_t filesize(const char *path);

Parameters

Key

Type

Description

path

const char *

Path to the file whose size is to be determined.


Return Value

Returns the size of the file in bytes. If the file does not exist or an error occurs, returns 0.

Notes

This function relies on stat(), which may fail if the file does not exist or if there are insufficient permissions.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples