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