Difference between revisions of "Prokee Module: file"

From prokee
Jump to navigation Jump to search
m (Text replacement - "http://www.andreaspollhammer.com/downloads/docu/html/" to "http://www.andreaspollhammer.com/lab/downloads/docu/html/")
 
(One intermediate revision by the same user not shown)
Line 26: Line 26:
  
 
== Implementations ==
 
== Implementations ==
* [http://www.andreaspollhammer.com/lab/docu/html/file_v01.php file (version v01)]
+
* [http://www.andreaspollhammer.com/lab/downloads/docu/html/file_v01.php file (version v01)]
  
 
[[Category:Prokee Modules]]
 
[[Category:Prokee Modules]]
 
[[Category:Filesystem Functions]]
 
[[Category:Filesystem Functions]]

Latest revision as of 17:15, 1 June 2019

The module file provides platform independent functions for file access.

File Access Modes

The following file access modes can be used:

Mode Direction Info
r input Opens a existing file for input. Fails, if the file does not exist.
r+ input and output Opens a existing file for input and output. Fails, if the file does not exist.
w output Opens a file for output. The file will be created, if it does not jet exist. The contents of an existing file will be discarded.
w+ input and output Opens a file for input and output. The file will be created, if it does not jet exist. The contents of an existing file will be discarded.
a output Opens a file for output. The file will be created, if it does not jet exist. The output will be appended on the end of the file.
a+ input and output Opens a file for input and output. The file will be created, if it does not jet exist. The output will be appended on the end of the file.
rt r+t rt+ wt w+t wt+ at a+t at+ - Adding a t, specifies text-mode. This is the default mode, so adding a t has no effect. This mode is system specific and should only be used for text files. Text-mode is useful, if files are shared between different applications on the same operating system.
rb r+b rb+ wb w+b wb+ ab a+b ab+ - When adding a b, the file will be opened in binary-mode. When using this mode, every byte is read (or written) as it is indeed stored in the file. This mode should be used when files are shared between different operating systems.

Implementations