33 lines
668 B
C
33 lines
668 B
C
#include <blue/core/stream.h>
|
|
#include <blue/core/stringstream.h>
|
|
#include <blue/ds/string.h>
|
|
#include <blue/io/file.h>
|
|
#include <blue/io/path.h>
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, const char **argv)
|
|
{
|
|
if (argc < 2) {
|
|
return -1;
|
|
}
|
|
|
|
const char *path_cstr = argv[1];
|
|
b_path *path = b_path_create_from_cstr(path_cstr);
|
|
|
|
b_file *src = NULL;
|
|
b_result result = b_file_open(NULL, path, B_FILE_READ_ONLY, &src);
|
|
if (b_result_is_error(result)) {
|
|
b_throw(result);
|
|
return -1;
|
|
}
|
|
|
|
b_stream_buffer *buf = b_stream_buffer_create_dynamic(1024);
|
|
|
|
size_t nr_read;
|
|
b_stream_read_all_bytes_s(src, b_stdout, buf, &nr_read);
|
|
|
|
b_stream_buffer_unref(buf);
|
|
|
|
return 0;
|
|
}
|