Files
fx/fx.io/test/pipes.c
T

24 lines
465 B
C

#include <fx/io/pipe.h>
#include <stdio.h>
int main(void)
{
fx_iostream *read = NULL, *write = NULL;
fx_status status = fx_pipe_create(&read, &write);
if (!FX_OK(status)) {
fprintf(stderr,
"failed to create pipe: %s\n",
fx_status_description(status));
return -1;
}
fx_stream_write_cstr(write, "Hello, world!\n", NULL);
char buf[128];
fx_stream_read_line(read, buf, sizeof buf);
printf("read from pipe: %s\n", buf);
return 0;
}