c-cpp-filemode
目录
mode | openmode & ~ate | Action if file already exists | Action if file does not exist |
---|---|---|---|
“r” | in | Read from start | Failure to open |
“w” | out, out|trunc | Destroy contents | Create new |
“a” | app, out|app | Append to file | Create new |
“r+” | out|in | Read from start | Error |
“w+” | out|in|trunc | Destroy contents | Create new |
“a+” | out|in|app, in | app | Write to end | Create new |
“wx” | out|noreplace, out|noreplace|trunc | Failure to open | Create new |
“w+x” | out|in|noreplace|trunc | Failure to open | Create new |
“rb” | binary|in | Read from start | Failure to open |
“wb” | binary|out, binary | out | trunc | Destroy contents | Create new |
“ab” | binary|app, binary | out | app | Write to end | Create new |
“r+b” | binary|out|in | Read from start | Error |
“w+b” | binary|out|in|trunc | Destroy contents | Create new |
“a+b” | binary|out|in|app, binary|in|app | Write to end | Create new |
“wbx” | binary|out|noreplace, binary|out|noreplace|trunc | Failure to open | Create new |
“w+bx” | binary|out|in|noreplace|trunc | Failure to open | Create new |