~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to man/fileio/mopen.man

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.TH mopen 1 "April 1999" "Scilab Group" "Scilab Function"
 
2
.so ../sci.an
 
3
.SH NAME
 
4
mopen - open a file  
 
5
.SH CALLING SEQUENCE
 
6
.nf
 
7
[fd,err]=mopen(file [, mode,  swap ])
 
8
.fi
 
9
.SH PARAMETERS
 
10
.TP 10
 
11
file
 
12
: a character string. The pathname of the file to open.
 
13
.TP
 
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.
 
18
.TP
 
19
swap 
 
20
: a scalar. If \fVswap\fR is present and \fVswap=0\fR then automatic
 
21
bytes swap is disabled.
 
22
.TP 
 
23
err
 
24
: a scalar. Error indicator
 
25
.TP
 
26
fd
 
27
: scalar. The \fVfd\fR parameter returned by the function \fVmopen\fR is
 
28
used as a file descriptor (it's a positive integer). 
 
29
 
 
30
.SH DESCRIPTION
 
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. 
 
35
.LP
 
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
 
39
.TP 10
 
40
r or rb
 
41
: Opens the file for reading.
 
42
.TP
 
43
w or wb
 
44
: Creates a new file for writing, or opens and truncates a file to zero
 
45
length. 
 
46
.TP
 
47
a or ab
 
48
: Appends (opens a file for writing at the end of the file, or creates a
 
49
file for writing).
 
50
.TP
 
51
r+ or r+b
 
52
: Opens a file for update (reading and writing).
 
53
.TP
 
54
w+ or w+b
 
55
: Truncates to zero length or creates a file for update. 
 
56
.TP
 
57
a+ or a+b
 
58
:Appends (opens a file for update, writing at the end of the file, or
 
59
creates a file for writing).
 
60
.RE
 
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.
 
68
 
 
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
 
75
output.
 
76
 
 
77
.LP
 
78
To open files in a way compatible with Fortran like functions use
 
79
function \fVfile\fR.
 
80
.SH SEE ALSO
 
81
mclose, meof, mfprintf, fprintfMat, mfscanf, fscanfMat, mget, mgetstr, mopen, mprintf, mput, mputstr, mscanf, mseek, mtell
 
82
 
 
83