~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to man/fileio/file.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 file 1 "April 1993" "Scilab Group" "Scilab Function"
 
2
.so ../sci.an
 
3
.SH NAME
 
4
file - file management
 
5
.SH CALLING SEQUENCE
 
6
.nf
 
7
[unit [,err]]=file('open', file-name [,status] [,access [,recl]] [,format])
 
8
file(action,unit)
 
9
[units [,typ [,nams [,mod [,swap]]]]] = file([unit])
 
10
.fi
 
11
.SH PARAMETERS
 
12
.TP 10
 
13
file-name
 
14
: string, file name of the file to be opened
 
15
.TP 10
 
16
status
 
17
: string, The status of the file to be opened
 
18
.RS
 
19
.TP 13
 
20
"new" 
 
21
: file must not exist new file (default)
 
22
.TP
 
23
"old" 
 
24
: file must already exists.
 
25
.TP
 
26
"unknown" 
 
27
: unknown status
 
28
.TP
 
29
"scratch" 
 
30
: file is to be deleted at end of session
 
31
.RE
 
32
.TP 10
 
33
access
 
34
: string, The type of access to the file
 
35
.RS
 
36
.TP 13
 
37
"sequential" 
 
38
: sequential access (default)
 
39
.TP
 
40
"direct" 
 
41
: direct access.
 
42
.RE
 
43
.TP 10
 
44
format
 
45
: string,
 
46
.RS
 
47
.TP 13
 
48
"formatted" 
 
49
: for a  formatted file (default)
 
50
.TP
 
51
"unformatted" 
 
52
: binary record.
 
53
.RE
 
54
.TP 10
 
55
recl
 
56
: integer,is the size of records in bytes when \fVaccess="direct"\fR
 
57
.TP
 
58
unit
 
59
: integer, logical unit descriptor of the opened file
 
60
.TP
 
61
units
 
62
: integer vector, logical unit descriptor of the opened files. Units 1
 
63
5 and 6 are reserved by the system for history file , input and output
 
64
devices.
 
65
.TP
 
66
typs
 
67
: Character string vector, type (C or Fortran) of opened files.
 
68
.TP
 
69
nams
 
70
: Character string vector, pathnames of opened files.
 
71
.TP
 
72
mod
 
73
: file opening mode. Formed by three digits abc
 
74
.RS
 
75
.TP 
 
76
Fortran files
 
77
.RS 
 
78
.TP 
 
79
a
 
80
: 0 stands for formatted and 1 for unformatted (binary)
 
81
.TP
 
82
b
 
83
: 0 stands for sequential acces and 1 for direct access
 
84
.TP
 
85
c
 
86
: 0 stands for  "new", 1 for "old", 2 for "scratch" and 3 for "unknown"
 
87
.RE
 
88
.TP
 
89
C files
 
90
.RS 
 
91
.TP 
 
92
a
 
93
: is 1 if file has been opened with a "b" (binary) mode
 
94
.TP
 
95
b
 
96
: is 1 if file has been opened with a "+" (updating) mode
 
97
.TP
 
98
c
 
99
: 1 stands for "r" (read), 2 stands for "w" (write) and 3 for "a" (append)
 
100
.RE
 
101
.RE
 
102
.TP
 
103
swap
 
104
: automatic swap switch. swap=1 if automatic swap is on. swap is
 
105
always 0 for Fortran files.
 
106
.TP
 
107
err
 
108
: integer, error message number (see error), if open fails. If err is
 
109
omitted an error message is issued.
 
110
.TP
 
111
action
 
112
: is one of the following strings:
 
113
.RS
 
114
.TP 13
 
115
"close" 
 
116
: closes the file(s) given by the logical unit descriptors given in \fVunits\fR
 
117
.TP
 
118
"rewind" 
 
119
: puts the pointer at beginning of file
 
120
.TP
 
121
"backspace" 
 
122
: puts the pointer at beginning of last record.
 
123
.TP
 
124
"last" 
 
125
: puts the pointer after last record.
 
126
.RE
 
127
.SH DESCRIPTION
 
128
selects a logical unit \fVunit\fR and manages the file
 
129
\fVfile-name\fR.
 
130
.LP
 
131
\fV[unit [,err]]=file('open', file-name [,status] [,access [,recl]]
 
132
[,format])\fR allows to open a file with specified properties and to
 
133
get the associated unit number \fVunit\fR. This unit number may be
 
134
used for further actions on this file or as file descriptor in
 
135
\fVread\fR, \fVwrite\fR, \fVreadb\fR, \fVwritb\fR,\fVsave\fR,
 
136
\fVload\fR function calls.
 
137
.LP
 
138
\fVfile(action,unit)\fR allows to close the file , or move the current
 
139
file pointer .
 
140
.LP
 
141
\fVfile()\fR returns the logical unit descriptors of the opened
 
142
files. So \fVfile('close',file() )\fR closes all user opened files (C
 
143
or Fortran type). 
 
144
.SH EXAMPLE
 
145
.nf
 
146
u=file('open',TMPDIR+'/foo','unknown')
 
147
for k=1:4
 
148
  a=rand(1,4)
 
149
  write(u,a)
 
150
end
 
151
file('rewind',u)
 
152
x=read(u,2,4)
 
153
file('close',u)
 
154
//
 
155
u1=file('open',TMPDIR+'/foo','unknown')
 
156
u2=mopen(TMPDIR+'/foo1','wb')
 
157
[units,typs,nams]=file()
 
158
.fi
 
159
.SH SEE ALSO
 
160
save, load, write, read, writb, readb, xgetfile, mopen, mclose