fx.io: import system-level streams and uni-directional pipes

This commit is contained in:
2026-06-10 19:08:36 +01:00
parent 15784c3404
commit 2512611f8f
5 changed files with 240 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#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;
}