fopen.3s (2010 09)

f
fopen(3S) fopen(3S)
ERRORS
fopen(), fdopen(), and freopen() fail if:
[EBADF] The fildes argument is not a valid file descriptor.
[EINVAL] The type argument is not a valid mode.
[ENOMEM] There is insufficient space to allocate a buffer.
fopen() and freopen() fail if:
[EACCES] Search permission is denied on a component of the path prefix, or the file exists and
the permissions specified by type are denied, or the file does not exist and write per-
mission is denied for the parent directory of the file to be created.
[EINTR] A signal was caught during
fopen()
or freopen(). function.
[EISDIR] The named file is a directory and type requires write access.
[EMFILE] The calling process has attempted to exceed its open file limit.
[ENAMETOOLONG]
The length of the pathname string exceeds
PATH_MAX
or a pathname component is
longer than
NAME_MAX while POSIX_NO_TRUNC
is in effect.
[ENFILE] The system file table is full.
[ENOENT] The named file does not exist or the pathname argument points to an empty string.
[ENOSPC] The directory or file system that would contain the new file cannot be expanded, the
file does not exist, and it was to be created.
[ENOTDIR] A component of the path prefix is not a directory.
[ENXIO] The named file is a character special or block special file, and the device associated
with the special file does not exist.
[EOVERFLOW] The named file is a regular file and the size of the file cannot be represented correctly
in an object of size
off_t in this environment.
[EROFS] The named file resides on a read-only file system and type requires write access.
Additional
errno values can be set by the underlying open() call made from the fopen() and
freopen() functions (see open(2)).
SEE ALSO
creat(2), dup(2), open(2), pipe(2), fclose(3S), fgetpos64(3S), fseek(3S), popen(3S), setbuf(3S), orienta-
tion(5), thread_safety(5), glossary(9).
STANDARDS CONFORMANCE
fopen(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C
fdopen(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
freopen(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010