c - How does open() have two definitions, as shown in the man-page? -
the man page of open()
shows open has 2 definitions.
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int open(const char *pathname, int flags); int open(const char *pathname, int flags, mode_t mode);
i trying make wrap around open add backtrace debugging. definition in fnctl.h
shows variable argument function
int open(const char *path, int oflag, ... );
but how can know whether mode present or not?
the mode
argument not needed open flags. example, if opening existing file reading, there's no need set file mode flags. on other hand, when creating file, need include mode.
see the documentation open
(or local manual page) see if need include argument or not.
Comments
Post a Comment