[Top][All Lists]

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

Re: Reading data from a file descriptor

From: Artyom Poptsov
Subject: Re: Reading data from a file descriptor
Date: Sat, 07 Nov 2015 18:16:15 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hello Jan,

do you need to read the data from the file descriptor in a Scheme
program?  If so, I guess you can make a wrapper procedure [1] that uses
'scm_fdes_to_port' from 'libguile.h' to convert your file descriptor to
a SCM port and return the port into the Scheme world.

Here's the description of 'scm_fdes_to_port' from GNU Guile 2.0.9

--8<---------------cut here---------------start------------->8---
/* Build a Scheme port from an open file descriptor `fdes'.
   MODE indicates whether FILE is open for reading or writing; it uses
      the same notation as open-file's second argument.
   NAME is a string to be used as the port's filename.
scm_i_fdes_to_port (int fdes, long mode_bits, SCM name)
--8<---------------cut here---------------end--------------->8---

Hope this helps,

- Artyom

[1] See '(guile) C Extensions' chapter from the Guile manual.

Artyom V. Poptsov <address@hidden>;  GPG Key: 0898A02F
Home page:

Attachment: signature.asc
Description: PGP signature

reply via email to

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