fchdir()
QNX SDP8.0C Library ReferenceAPIDeveloper
Change the working directory
Synopsis:
#include <unistd.h>
int fchdir(int fd);
Arguments:
- fd
- A file descriptor for the directory that you want to become the current working directory.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
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.
Returns:
0, or -1 if an error occurred (errno is set). If the function fails, the current working directory isn't changed.
Errors:
- EACCES
- Search permission is denied for the directory referenced by fd.
- EBADF
- The fd argument isn't an open file descriptor.
- ENOTDIR
- The open file descriptor fd wasn't opened with O_DIRECTORY. You can obtain a file descriptor for a directory by calling open() with the O_DIRECTORY flag set.
- EINTR
- A signal was caught during the execution of fchdir().
- EIO
- An I/O error occurred while reading from or writing to the filesystem.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |
Page updated: