C Standard Library Extensions 1.1
|
Functions | |
cxlong | cx_path_max (const cxchar *path) |
Get the maximum length of a path relative to the given directory. | |
cxchar * | cx_path_alloc (const char *path) |
Allocate a buffer suitable for storing a relative pathname staring at a given directory. |
The module provides a collection of useful file and file path related utility functions.
#include <cxfileutils.h>
cxchar* cx_path_alloc | ( | const char * | path | ) |
Allocate a buffer suitable for storing a relative pathname staring at a given directory.
path | Directory name the relative path should start from. |
NULL
in case of an error.The function determines the maximum possible length of a relative path name when path is the current working directory. A buffer with the appropriate length for the relative pathname including the trailing zero. The argument path must be the name of an existing, or the function fails. The allocated buffer can be destroyed by calling cx_free().
IF the string "/" is used for path the returned buffer will have the maximum length possible for an absolute path supported by the system (but see the note for cx_path_max() for pitfalls).
References cx_calloc(), and cx_path_max().
cxlong cx_path_max | ( | const cxchar * | path | ) |
Get the maximum length of a path relative to the given directory.
path | Directory name. |
The function returns the maximum length a relative path when path is the current working directory. To get the maximum possible length of an absolute path pass "/" for path, but see the note below. The size is determined through the pathconf() function, or if this is not available the maximum length is simply set to the ad hoc length of 4095 characters.
Referenced by cx_path_alloc().