From 70018176f2ba59e3027d94dc8b4804a91cf81764 Mon Sep 17 00:00:00 2001 From: Hemal Chevli Date: Sat, 9 Apr 2016 11:56:57 +0530 Subject: [PATCH] added descriptions for fopen modes added fopen modes for easy reference Source:http://man7.org/linux/man-pages/man3/fopen.3.html --- doc/filesystem.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/filesystem.md b/doc/filesystem.md index 6ee097513..d3dbebf5f 100644 --- a/doc/filesystem.md +++ b/doc/filesystem.md @@ -105,6 +105,28 @@ Opens a file. `path` should be an absolute path starting with a slash (e.g. `/dir/filename.txt`). `mode` is a string specifying access mode. It can be one of "r", "w", "a", "r+", "w+", "a+". Meaning of these modes is the same as for `fopen` C function. + + r Open text file for reading. The stream is positioned at the + beginning of the file. + + r+ Open for reading and writing. The stream is positioned at the + beginning of the file. + + w Truncate file to zero length or create text file for writing. + The stream is positioned at the beginning of the file. + + w+ Open for reading and writing. The file is created if it does + not exist, otherwise it is truncated. The stream is + positioned at the beginning of the file. + + a Open for appending (writing at end of file). The file is + created if it does not exist. The stream is positioned at the + end of the file. + + a+ Open for reading and appending (writing at end of file). The + file is created if it does not exist. The initial file + position for reading is at the beginning of the file, but + output is always appended to the end of the file. Returns *File* object. To check whether the file was opened successfully, use the boolean operator.