The following functions were added to XLISP by Niels Mayerfor use with WINTERP. These functions are UN*X-specific:
POPEN - start a process and open a pipe as a read/write stream (popen <shell-command> :direction <direction>) <shell-cmd> is a string which is sent to shell /bin/sh and is executed as command. <direction> a keyword symbol, :input means a stream is created that reads from stdout of <shell-cmd>; :output means a stream is created that writes to stdin of <shell-cmd>. (:input is the default.) returns a stream, or NIL if the pipe or /bin/sh process couldn't be created.PCLOSE -- close a pipe stream as opened by POPEN. (pclose <stream>) <stream> a stream object created by POPEN returns T if the command executed successfully, else returns the integer exit status of <shell-cmd>.SYSTEM - run a process, sending output (if any) to stdout/stderr (system <shell-cmd>) <shell-cmd> is a string which is sent to shell /bin/sh and is executed as command. returns T if the command executed successfully, else returns the integer exit status of <shell-cmd>.FSCANF-FIXNUM - read a fixnum value from a stream using fscanf(3x). (fscanf-fixnum <stream> <format>) <stream> a stream object created via OPEN or POPEN. Will give an error for "unnamed streams". <format> a format string containing a single conversion directive that will result in an integer valued conversion %d, %u, %o, %x, %ld, %lu, %lo and %lx style conversions are acceptable for this routine. See the manual page for fscanf(3x) for details. returns an integer if fscanf(3x) reports that the conversion specified by <format> succeeded. Returns NIL if the conversion wasn't successful, or if EOF was reached.
WARNING: specifying a <format> that will result in the
conversion of a result larger than sizeof(long) will result in
corrupted memory and core dumps.
FSCANF-STRING - read a string value from a stream using fscanf(3x). (fscanf-string <stream> <format>) <stream> a stream object created via OPEN or POPEN. Will give an error for "unnamed streams". <format> a format string containing a single conversion directive that will result in a string valued conversion. %s, %c, and %[...] style conversions are acceptable for this routine. See the manual page for fscanf(3x) for details. returns a string if fscanf(3x) reports that the conversion specified by <format> succeeded. Returns NIL if the conversion wasn't successful, or if EOF was reached.
WARNING: specifying a <scanf-format> that will result in the
conversion of a result larger than 1024 characters will result
in corrupted memory and core dumps.
FSCANF-FLONUM - read a float from a stream using fscanf(3x). (fscanf-flonum <stream> <format>) <stream> a stream object created via OPEN or POPEN. Will give an error for "unnamed streams". <format> a format string containing a single conversion directive that will result in a FLONUM valued conversion. %e %f or %g are valid conversion specifiers for this routine. See the manual page for fscanf(3x) for details. returns a float if fscanf(3x) reports that the conversion specified by <format> succeeded. Returns NIL if the conversion wasn't successful, or if EOF was reached.
WARNING: specifying a <scanf-format> that will result in the
conversion of a result larger than sizeof(float) will result in
corrupted memory and core dumps.
Operation | Meaning |
open | Prepare a device or file for |
input or output operations | |
close | Terminate use of a previously |
opened device or file | |
read | Obtain data from an input device |
or file, and place it in the application | |
program's memory | |
write | Transmit data from the application |
program's memory to an output device | |
or file | |
lseek | Move to a specific position in a |
file or device (this operation only | |
applies to files or devices like disks) | |
ioctl | Control a device or the software used to |
access it (e.g., specify the size of a buffer | |
or change the character set mapping) | |
copyright © 1999 bySMELLY CAT®. All rights reserved.