IMind soft

Author's software

Development

Design

Designing

Being tested

Open file

 

openfile(path to file, mode)

Opens the file with path to file (along with the file name). Returns the handle of the open file. Modes to open a file specified by the string:

The mode string specifies the type of access that is requested for the file, as follows:

"r"
Opens for reading. If the file does not exist or cannot be found, the function returns an empty handle

"w"
Opens an empty file for writing. If the specified file exists, its contents are deleted.

"a"
Opens for writing at the end of the file (append) without removing the marker at the end of the file (EOF) before writing new data to the file. Creates a file if it does not exist.

"r+"
Opens for reading and writing. The file must exist.

"w+"
Opens an empty file for reading and writing. If the file exists, its contents are deleted.

"a+"
Opens for reading and appending. The appending operation includes the removal of the EOF marker before writing new data to the file.

The "openfile" function opens a file with the specified parameters. The file name is passed in the "path to file" argument, and the file opening mode is passed in the "mode" argument.

Example of using the function:

openfile("example.txt", "r");

If the file is not found, the function displays the message "File not found.". If you do not have read or write rights to the file, the function displays the message "File access rights are missing.". In all other cases, the function outputs a message describing the error that occurred.

Top.Mail.Ru