f_getpermission


Use this function to retrieve the file or directory attribute/permission field associated with a file.

The number of bits in the attr attribute field is determined by the F_ATTR_SIZE setting in the config.h file. All of those bits are freely programmable except the F_ATTR_DIR directory attribute bit (also defined in config.h).

Format

int f_getpermission (
    const char *    filename,
    F_ATTR_TYPE *   attr)

Arguments

Argument Description Type
filename The name of the file or directory. char *
attr

Where to store the attribute.

F_ATTR_TYPE *

Return values

Return value Description
F_NOERR Successful execution.
Else See Error Codes.

Example

void myfunc( void ) 
{
    F_ATTR_TYPE  secure;
    if (!f_getpermission( "subfolder", &secure )) 
    {
        printf( "Permission is: %d", secure );
    }
    else
    {
        printf( "Permission cannot be retrieved!" );
    }
}