XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

29  File I/O Functions


  1. open - open a file stream
  2. close - close a file stream
  3. read-char - read a character from a stream
  4. peek-char - peek at the next character
  5. write-char - write a character to a stream
  6. read-line - read a line from a stream
  7. read-byte - read a byte from a stream
  8. write-byte - write a byte to a stream

Note: A description of all Nyquist file I/O functions can be found in Chapter 34.


(open fname &key :direction) - open a file stream
fname - the file name string or symbol
:direction - :input or :output [default is :input]
returns - a stream

(close stream) - close a file stream
stream - the stream
returns - NIL

(read-char [stream]) - read a character from a stream
stream - the input stream [default is standard input]
returns - the character

(peek-char [flag [stream]]) - peek at the next character
flag - flag for skipping white space [default is NIL]
stream - the input stream [default is standard input]
returns - the character [integer]

(write-char ch [stream]) - write a character to a stream
ch - the character to write
stream - the output stream [default is standard output]
returns - the character

(read-line [stream]) - read a line from a stream
stream - the input stream [default is standard input]
returns - the string

(read-byte [stream]) - read a byte from a stream
stream - the input stream [default is standard input]
returns - the byte [integer]

(write-byte byte [stream]) - write a byte to a stream
byte - the byte to write [integer]
stream - the output stream [default is standard output]
returns - the byte [integer]

XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next