Branch
Hash :
43a0193b
Author :
Thomas de Grivel
Date :
2017-06-20T22:50:37
fd-flexi streams are flexi streams using fd-gray streams to embed Unix file descriptors in standard Common Lisp streams supporting dynamic external encoding.
Creates an input flexi stream for file descriptor fd, initially using external-format encoding.
(read-line (fd-flexi:input-stream 0))
Creates an output flexi stream for file descriptor fd, initially using external-format encoding.
(write-string "Hello world !" (fd-flexi:output-stream 1))
Creates an input/output flexi stream for file descriptor fd, initially using external-format encoding.
(let ((stream (fd-flexi:io-stream (fcntl:open "file.txt" fcntl:+o-rdwr+))))
(write-string (read-line stream) stream))
Creates an input flexi stream for file descriptor fd, initially using external-format encoding, that will be closed returning from body.
(fd-flexi:with-input-stream (in (fcntl:open "file.txt" fcntl:+o-rdonly+))
(read-line in))
Creates an output flexi stream for file descriptor fd, initially using external-format encoding, that will be closed returning from body.
(fd-flexi:with-output-stream (out (fcntl:open "file.txt" fcntl:+o-wronly+))
(write-string "Hello world !" out))
Creates an input/output flexi stream for file descriptor fd, initially using external-format encoding, that will be closed returning from body.
(fd-flexi:with-io-stream (out (fcntl:open "file.txt" fcntl:+o-rdwr+))
(write-string (read-line stream) stream))