doc
Functions
cynapses libc directory functions

Functions

int c_isdir (const char *path)
 
int c_mkdirs (const char *path, mode_t mode)
 
int c_rmdirs (const char *dir)
 

Detailed Description

Function Documentation

◆ c_isdir()

int c_isdir ( const char *  path)

Check if a path is a directory.

Parameters
pathThe path to check.
Returns
1 if the path is a directory, 0 if the path doesn't exist, is a file or can't be accessed.

◆ c_mkdirs()

int c_mkdirs ( const char *  path,
mode_t  mode 
)

Create parent directories as needed.

The newly created directory will be owned by the effective user ID of the process.

Parameters
pathThe path to the directory to create.
modeSpecifies the permissions to use. It is modified by the process's umask in the usual way: the permissions of the created file are (mode & ~umask).
Returns
0 on success, < 0 on error with errno set:
  • EACCES The parent directory does not allow write permission to the process, or one of the directories
  • ENOTDIR if durl is not a directory
  • EINVAL NULL durl passed or smbc_init not called.
  • ENOMEM Insufficient memory was available.
See also
mkdir()

◆ c_rmdirs()

int c_rmdirs ( const char *  dir)

Remove the directory and subdirectories including the content.

This removes all directories and files recursivly.

Parameters
dirThe directory to remove recusively.
Returns
0 on success, < 0 on error with errno set.