Files
fx/fx.collections/test/streams.c

20 lines
529 B
C

#include <fx/stream.h>
#include <fx/string.h>
#include <fx/stringstream.h>
#include <stdio.h>
int main(int argc, const char **argv)
{
size_t nr_read = 0;
fx_stringstream *dest_stream = fx_stringstream_create();
fx_stream_buffer *buf = fx_stream_buffer_create_dynamic(1024);
fx_stream_read_all_bytes_s(fx_stdin, dest_stream, buf, &nr_read);
printf("done. read %zu bytes total.\n", nr_read);
printf("%s\n", fx_stringstream_ptr(dest_stream));
fx_stringstream_unref(dest_stream);
fx_stream_buffer_unref(buf);
return 0;
}