Openfile Function

Next: , Previous: Input, Index: Index

This openfile[n,a] function will open the file of name n with mode of a.

Pass: The name of the file to open type String and mode type String
Returns:A file handle of type File

Mode Description Starts
r Open for reading Beginning
w Open for writing (create if not exist) Beginning
a Open for appending (create if not exist) End
r+ Open for reading and writing Beginning
w+ Open for reading and writing, deletes contents and overwrites the file Beginning
a+ Open for reading and writing (append if file exists) End

Adding b to the mode will expect that the file is a binary one, without it is expected that the file is a text file.

Examples

var f:=openfile["myfile.txt","r"];
closefile[f];


Last Modified: August 2008