void open ( const char * filename, openmode mode );
filename
.
The stream's file buffer is associated with the specified file to perform the I/O operations.
filename
: String containing the name of the file to be opened.mode
: Flags describing the requested I/O mode for the file. This is an object of type ios_base::openmode
, it generally consist of a combination of the following flags (member constants):Bit | Effect |
---|---|
app |
(append) Seek to the end of the stream before each output operation. |
ate |
(at end) Seek to the end of the stream when opening. |
binary |
Consider stream as binary rather than text. |
in |
Allow input operations on a stream. |
out |
Allow output operations on a stream. |
trunc |
(truncate) Truncate file to zero when opening. |
open
command works: