Go to the first, previous, next, last section, table of contents.
#include <unistd.h> size_t confstr(int name, char *buf, size_t len);
This function stores various system-dependent configuration values in buf. name is one of the following:
_CS_PATH
_CS_POSIX_V6_ILP32_OFF32_CFLAGS
int
, long
, pointer, and off_t
types.
_CS_POSIX_V6_ILP32_OFF32_LDFLAGS
int
, long
, pointer, and off_t
types.
_CS_POSIX_V6_ILP32_OFF32_LIBS
int
, long
, pointer, and off_t
types.
If len is not zero and name has a defined value, that value is copied into buf and null terminated. If the length of the string to be copied plus the null terminator is greater than len bytes, the string is truncated to len-1 bytes and the result is null terminated.
If len is zero, nothing is copied into buf and the size of the buffer required to store the string is returned.
If name has a defined value, the minimum size of the buffer required to hold the string including the terminating null is returned. If this value is greater than len, then buf is truncated.
If name is valid but does not have a defined value, zero is returned.
If name is invalid, zero is returned and errno
is set to
EINVAL
.
not ANSI, POSIX
char *path; size_t path_len; path_len = confstr (_CS_PATH, NULL, 0); path = malloc(path_len); confstr(_CS_PATH, path, path_len);
Go to the first, previous, next, last section, table of contents.