1
.TH mopen 1 "April 1999" "Scilab Group" "Scilab Function"
7
[fd,err]=mopen(file [, mode, swap ])
12
: a character string. The pathname of the file to open.
14
mode : a character string that controls whether the file is opened
15
for reading (r), writing (w), or appending (a) and whether the file is
16
opened for updating (+). The mode can also include a b parameter to
17
indicate a binary file.
20
: a scalar. If \fVswap\fR is present and \fVswap=0\fR then automatic
21
bytes swap is disabled.
24
: a scalar. Error indicator
27
: scalar. The \fVfd\fR parameter returned by the function \fVmopen\fR is
28
used as a file descriptor (it's a positive integer).
31
\fVmopen\fR may be used to open a file in a way compatible with the C
32
\fVfopen\fR procedure. Without swap argument the file is supposed to
33
be coded in "little endian IEEE format" and data are swaped if
34
necessary to match the IEEE format of the processor.
36
The mode parameter controls the access allowed to the stream. The
37
parameter can have one of the following values. In this list of
38
values, the b character indicates a binary file
41
: Opens the file for reading.
44
: Creates a new file for writing, or opens and truncates a file to zero
48
: Appends (opens a file for writing at the end of the file, or creates a
52
: Opens a file for update (reading and writing).
55
: Truncates to zero length or creates a file for update.
58
:Appends (opens a file for update, writing at the end of the file, or
59
creates a file for writing).
61
When you open a file for update, you can perform both input and output
62
operations on the resulting stream. However, an output operation
63
cannot be directly followed by an input operation without a
64
file-positioning operation (mseek() function). Also, an input
65
operation cannot be directly followed by an output operation without
66
an intervening file positioning operation, unless the input operation
67
encounters the end of the file.
69
When you open a file for append (that is, when the mode parameter is a
70
or a+), it is impossible to overwrite information already in the
71
file. You can use the fseek() function to reposition the file pointer
72
to any position in the file, but when output is written to the file,
73
the current file pointer is ignored. All output is written at the end
74
of the file and the file pointer is repositioned to the end of the
78
To open files in a way compatible with Fortran like functions use
81
mclose, meof, mfprintf, fprintfMat, mfscanf, fscanfMat, mget, mgetstr, mopen, mprintf, mput, mputstr, mscanf, mseek, mtell