b = file_handler.open(file_nameʃ, update ‖ append ‖ createʅ);
The
File.open function associates the
File file_handler to a text file on the disk. The
file_name argument is a string expression containing the file name of the file to be associated with the file. This function is equivalent to the
setfile function.
Using the keyword update, append or create is optional. If no keyword is used, the file is opened in update mode.
If update is used, you are positioned at the beginning of the file. If append is used, the file's contents are not changed and you are positioned at the end of the file. If create is used, all previous content in the file is removed and you are positioned at the beginning of the file.
If create or append is used and the file does not already exist, a new empty file will be created. If update is used and the file does not already exist, the function will fail and return 0.
The function returns a logical value of 1 (true) if the new file is successfully assigned and 0 (false) otherwise.
File household_report_file;
household_report_file.open("Household Report.txt", create);