I saw a code snippet using fopen(file_name, "r+e")
. What does the e
flag mean in fopen? I couldn't find any information from the linux man page.
The key difference between the fopen() and the open() function in the Linux operating system is that the open() function is a low-level call, where the fopen() when called simply calls the open() function in the background and it returns a Filepointer directly.
The open function is the underlying primitive for the fopen and freopen functions, that create streams. Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | See POSIX Safety Concepts. This function is similar to open . It returns a file descriptor which can be used to access the file named by filename .
On a GNU webpage I found that the e
means that the "file descriptor will be closed if you use any of the exec… functions".
It's documented in the man page on my system (release 3.54 of the Linux man-pages project).
e (since glibc 2.7)
Open the file with theO_CLOEXEC
flag. Seeopen(2)
for more information. This flag is ignored forfdopen()
.
Scroll down; it's under "Glibc notes". This is a non-standard extension.
An online copy of the man page is here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With