/usr/lib/s9fes/help/sys_read is in scheme9 2010.11.13-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | S9 EXT (sys:read integer1 integer2) ==> string
(sys:write integer1 string) ==> integer
SYS:READ reads up to INTEGER2 bytes directly from file descriptor
INTEGER1, stores them in a string, and returns that string.
SYS:WRITE writes STRING directly to file descriptor INTEGER1 and
returns the number of bytes written.
SYS:READ can read a binary file. In this case, it will return
a string containing characters with no external representation.
When SYS:READ attempts to read beyond the EOF, it will return
an empty string rather than the EOF object. Caveat utilitor!
Whenever possible the Scheme I/O functions, such as READ-CHAR,
WRITE-CHAR, DISPLAY, etc, should be used instead of SYS:READ
and SYS:WRITE.
; This example will overwrite "tmpfile"!
;
(let ((fd (sys:creat "tmpfile" #o644)))
(sys:write fd "xyz")
(sys:close fd)
(set! fd (sys:open "tmpfile" sys:read-only))
(let ((s (sys:read fd 17)))
(sys:close fd)
s)) ==> "xyz"
|