file_permission()

file_permission()#

The file_permission() function retrieves the permission mode of a specified file path.

Prototype

mode_t file_permission(const char *path);

Parameters

Key

Type

Description

path

const char *

The file path whose permission mode is to be retrieved.


Return Value

Returns the permission mode of the file as a mode_t value. If the file does not exist or an error occurs, returns 0.

Notes

This function internally uses stat() to obtain the file’s mode and extracts the permission bits using bitwise operations.

Prototype

// Not applicable in JS

Prototype

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