Correspondence between Unix system call ʻopen` and libc` fopen () `

The correspondence between the system call ʻopen and libc fopen () `is summarized.

System call C library function motion
open("file", O_RDONLY) fopen("file", "r") Read
open("file", O_RDWR) fopen("file", "r+") Existing reading and writing
open("file", O_WRONLY|O_CREAT|O_TRUNC, 0666) fopen("file", "w") writing
open("file", O_RDWR|O_CREAT|O_TRUNC, 0666) fopen("file", "w+") New write
open("file", O_WRONLY|O_CREAT|O_APPEND, 0666) fopen("file", "a") Additional writing
open("file", O_RDWR|O_CREAT|O_APPEND, 0666) fopen("file", "a+") Additional read / write

Personally, open is more flexible, so I use it a lot.

Recommended Posts

Correspondence between Unix system call ʻopen` and libc` fopen () `
Correspondence between pandas and SQL
Correspondence between RecyclerView and Marker (Kotlin)
Correspondence between Python built-in functions and Rust
Differences between glibc, musl libc and go resolvers
What is the difference between Unix and Linux?