File: file.man

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