问题
I was writing a safe enum class
for the different file flags listed in open(3)
, when I noticed that I couldn't find the written-out word for O_EXCL
.
enum class Flags {
readOnly, // O_RDONLY
truncate, // O_TRUNC
? // O_EXCL
};
Two possible meanings come into my mind:
OPEN_EXCLUSIVE
OPEN_EXISTS_CLOSE
But I can't find any resources on the intended meaning.
回答1:
Exclusive would be a correct word here, since the flag is exclusive to the O_CREAT
flag and makes the function fail if the file exists. (If the O_CREAT
flag is not set the behavior is undefined.)
来源:https://stackoverflow.com/questions/48388212/what-is-the-written-out-word-for-o-excl