Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference
open-binary
Type: |
- |
function (subr) |
Source: |
- |
xlfio.c |
Syntax
- (open-binary file [:direction in-out])
- file - a string expression or symbol
in-out - an optional keyword symbol that must be either ':input' or
':output'. The default is ':input'.
returns - a stream
Description
The 'open-binary' function opens the 'file' for binary input
or output. The 'file' may be a string expression or a symbol. Following the
'file', there is an optional keyword, ':direction'. The argument following
this is either ':input' or ':output' which specifies the direction of the
file. If no ':direction' is specified, the default is ':input'.
When 'file' is a string, you may specify a complete file location or
extensions like "/usr/local/bin/myfile.lsp" or
"A:\LISP\TIM.BAT". If the file open was successful,
then a file pointer of the following form is returned as the result:
#<File: #99999>
If the file open was not successful, a NIL is
returned. For an input file, the file has to exist, or an error
will be signaled.
Examples
This will create a file named FOO-FILE, because XLISP uppercases its
symbols:
(open-binary 'foo-file :direction :output)
This will create a file named 'foo-file' because UNIX doesn't
uppercase its file names:
(open-binary "foo-file" :direction :output)
So, if you are having trouble with opening and accessing files, check to
make sure the file name is in the proper case.
See also bigendianp,
read-int,
write-int,
read-float,
write-float.
Back to Top
Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference