We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ffecba9 commit f4fde6bCopy full SHA for f4fde6b
1 file changed
examples/stdlib.c
@@ -2117,7 +2117,8 @@ static int stdio_parse_mode(const char *mode)
2117
flags = (plus != '+'? O_RDONLY: O_RDWR);
2118
break;
2119
case 'w':
2120
- flags = (plus != '+'? O_WRONLY | O_CREAT: O_RDWR | O_CREAT);
+ flags = (plus != '+'? O_WRONLY | O_CREAT | O_TRUNC:
2121
+ O_RDWR | O_CREAT | O_TRUNC);
2122
2123
case 'a':
2124
flags = (plus != '+'? O_WRONLY | O_CREAT | O_APPEND:
0 commit comments