Change the working directory
#include <unistd.h> int fchdir(int fd);
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The fchdir() function is similar to chdir(), except that you use a file descriptor to specify the directory that you want to become the new current working directory. You can obtain a file descriptor for a directory by calling open(), provided that the file status flags and access modes don't contain O_WRONLY or O_RDWR.
0, or -1 if an error occurred (errno is set). If the function fails, the current working directory isn't changed.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
chdir(), errno, getcwd(), mkdir(), rmdir()