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
|
file(1) Scilab Function file(1)
NAME
file - file management
CALLING SEQUENCE
[unit [,err]]=file('open', file-name [,status] [,access [,recl]] [,format])
file(action,unit)
PARAMETERS
file-name : string, file name of the file to be opened
status : string, The status of the file to be opened
"new" : file must not exist new file (default)
"old" : file must already exists.
"unknown" : unknown status
"scratch" : file is to be deleted at end of session
access : string, The type of access to the file
"sequential" : sequential access (default)
"direct" : direct access.
format : string,
"formatted" : for a formatted file (default)
"unformatted"
: binary record.
recl : integer,is the size of records in bytes when access="direct"
unit : integer, logical unit descriptor of the opened file
err : integer, error message number (see error), if open fails. If
err is omitted an error message is issued.
action : is one of the following strings:
"close" : closes the file
"rewind" : puts the pointer at beginning of file
"backspace" : puts the pointer at beginning of last record.
"last" : puts the pointer after last record.
DESCRIPTION
selects a logical unit unit and manages the file file-name.
[unit [,err]]=file('open', file-name [,status] [,access [,recl]] [,format])
allows to open a file with specified properties and to get the associated
unit number unit. This unit number may be used for further actions on this
file or as file descriptor in read, write, readb, writb,save, load function
calls.
file(action,unit) allows to close the file , or move the current file
pointer .
EXAMPLE
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)
SEE ALSO
save, load, write, read, writb, readb, xgetfile
|