Skip to content

Commit 1f38703

Browse files
committed
Merge pull request #1888 from hemalchevli/patch-2
added descriptions for fopen modes
2 parents 60b18bf + 7001817 commit 1f38703

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

doc/filesystem.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,28 @@ Opens a file. `path` should be an absolute path starting with a slash
105105
(e.g. `/dir/filename.txt`). `mode` is a string specifying access mode. It can be
106106
one of "r", "w", "a", "r+", "w+", "a+". Meaning of these modes is the same as
107107
for `fopen` C function.
108+
109+
r Open text file for reading. The stream is positioned at the
110+
beginning of the file.
111+
112+
r+ Open for reading and writing. The stream is positioned at the
113+
beginning of the file.
114+
115+
w Truncate file to zero length or create text file for writing.
116+
The stream is positioned at the beginning of the file.
117+
118+
w+ Open for reading and writing. The file is created if it does
119+
not exist, otherwise it is truncated. The stream is
120+
positioned at the beginning of the file.
121+
122+
a Open for appending (writing at end of file). The file is
123+
created if it does not exist. The stream is positioned at the
124+
end of the file.
125+
126+
a+ Open for reading and appending (writing at end of file). The
127+
file is created if it does not exist. The initial file
128+
position for reading is at the beginning of the file, but
129+
output is always appended to the end of the file.
108130

109131
Returns *File* object. To check whether the file was opened successfully, use
110132
the boolean operator.

0 commit comments

Comments
 (0)