open - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


open

opens a file for unbuffered reading or writing

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

open(name, mode)

Parameters

name

-

name of the file to be opened

mode

-

one of READ or WRITE

Description

• 

The open function opens the file with the specified name for unbuffered reading or writing (as specified by mode) and returns a file descriptor (a small integer).

• 

RAW file I/O is always done with a file type of BINARY.

• 

The special file names 'default' and 'terminal', referring to the current and top-level input or output streams, cannot be used with open.

• 

If the file is being opened for reading and does not exist, open generates an error.

• 

If the file is being opened for writing and does not exist, it is created if possible; otherwise, open generates an error.

• 

If the file is already open, open generates an error.

• 

If the limit for the maximum number of simultaneously open files has been reached, open generates an error.

Examples

fdopentestFile,WRITE

fd0

(1)

fprintffd,This is a test\n

15

(2)

closefd

See Also

close

file_types

FileTools[Binary][Open]

FileTools[Text][Open]

fopen

IO_errors