Opens a file for shared reading or writing.
#include <fcntl.h> #include <share.h> #include <sys/stat.h> #include <io.h> int sopen (const char *filename, int oflag, int shflag, int pmode);
filename
oflag
shflag
pmode
shflag
must be one of these manifest constants:
Value | Description |
---|---|
SH_DENYRW | Denies read and write access to file. |
SH_DENYWR | Denies write access to file. |
SH_DENYRD | Denies read access to file. |
SH_DENYNO | Permits read and write access. |
Ownership and access rights are set when the new file is closed for the first time.
sopen applies the default file-permission mask (set with umask) to pmode
before set ting the permissions.
This function performs a translation of POSIX file ownership rights and POSIX access rights to the real-time OS equivalent as described in chmod.
EACCES | Given pathname is a directory; or The file is read-only but an open for writing was attempted; or A sharing violation occurred because the file's share mode does not allow the specified operations. |
EEXIST | The O_CREAT and O_EXCL flags are specified, but the named file already exists. |
EINVAL | An invalid oflag or shflag argument was given. |
EMFILE | No more file descriptors available (too many open files). |
ENOENT | File or pathname not found. |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/io.h | fcntl.h share.h sys/stat.h io.h |
clib.lib |