unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Reading data from a file descriptor
@ 2015-11-07 14:52 Jan Synáček
  2015-11-07 15:16 ` Artyom Poptsov
  0 siblings, 1 reply; 22+ messages in thread
From: Jan Synáček @ 2015-11-07 14:52 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 572 bytes --]

Hello Guilers,

how do I read data from a file descriptor? I already have an fd required
from elsewhere that I need to read data from and actually have no idea how
to do that. I read through the documentation on ports, but that didn't
help. The fd actually points to a socket.

In C, I have something like this:

    const size_t bufsize = 4096;
    char buf[bufsize+1];
    ssize_t count;
    int fd;

    fd = require_valid_fd()

    count = read(fd, buf, bufsize);
    buf[count] = '\0';
    printf("read: %s\n", buf);

Cheers,
-- 
Jan Synáček

[-- Attachment #2: Type: text/html, Size: 803 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-06-20 10:58 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-07 14:52 Reading data from a file descriptor Jan Synáček
2015-11-07 15:16 ` Artyom Poptsov
2015-11-07 15:29   ` Artyom Poptsov
2015-11-07 23:49     ` Andreas Rottmann
2015-11-09  7:25       ` Jan Synáček
2015-11-13 15:51         ` Mark H Weaver
2015-11-13 20:41           ` Jan Synáček
2015-11-13 20:45             ` Thompson, David
2015-11-15 11:09               ` Jan Synáček
2015-11-15 12:05                 ` Thompson, David
2015-11-16 10:54             ` Amirouche Boubekki
2015-11-17  9:53               ` tomas
2015-11-17 12:59                 ` Chris Vine
2015-11-17 12:52                   ` tomas
2015-11-17 13:55                     ` Chris Vine
2015-11-17 13:33                       ` tomas
2016-06-20 10:40                       ` Andy Wingo
2016-06-20 10:58                         ` tomas
2015-11-18  8:28                   ` Jan Synáček
2015-11-16 13:02           ` tomas
2015-11-23 21:07             ` Andreas Rottmann
2015-11-24 15:28               ` tomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).