[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read-string!/partial on non-file ports
From: |
Ludovic Courtès |
Subject: |
Re: read-string!/partial on non-file ports |
Date: |
Tue, 11 Sep 2007 01:19:19 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Hi,
"Luigi Semenzato" <address@hidden> writes:
> I would like to move binary data between two guile
> applications across a pipe (opened with open-input-output-pipe).
> Read-char and write-char in a loop are going to be too slow.
> Read-string!/partial and write-string/partial are exactly what
> I need but they only work on file ports. (I get this error:
> Wrong type argument in position 2 (expecting open file port):
> #<input-output: soft 56f1d0>).
>
> Two questions.
>
> 1. Do I have other choices? I cannot find any.
Using strings for binary I/O is Bad because it assumes a specific
bit-representation of strings (namely, ASCII).
SRFI-4 vectors and `uniform-vector-read!'/`uniform-vector-write' may be
a better match.
If you're not afraid of using experimental code, you might also want to
try Guile-R6RS-Libs, which includes part of R6RS' binary I/O API
(actually based on R5.92RS):
http://www.laas.fr/~lcourtes/software/guile/guile-r6rs-libs-0.0.tar.gz
http://www.r6rs.org/document/lib-html-5.92/r6rs-lib-Z-H-4.html#node_chap_2
http://www.r6rs.org/document/lib-html-5.92/r6rs-lib-Z-H-9.html#node_sec_7.2
Thanks,
Ludovic.