guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read-string!/partial on non-file ports


From: Luigi Semenzato
Subject: Re: read-string!/partial on non-file ports
Date: Mon, 10 Sep 2007 22:00:44 -0700

Wow, thanks for all the help.

Mike and Kevin pointed out that it's probably
best to use socketpair rather than pipe.  Of course.  I am
such a troglodyte.  Kevin's example looks robust and I
used it almost verbatim (I assume it's OK).  It works
fine.

Ludovic suggests that uniform vectors are better than
strings for raw data.  Yes.  The distinction is not vital for
me at this point, but if I get beyond a prototype, that's
the right direction.

For the moment I'll pass on the suggestion of using
Guile-R6RS-Libs.  The language is large enough as it is
and I am learning it as I go along.

Thanks again!
Luigi


On 9/10/07, Ludovic Courtès <address@hidden> wrote:
> 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.
>
>
>
> _______________________________________________
> Guile-user mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/guile-user
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]