You can use fwrite
to write unformatted data:
char buf[4] = { 1, 2 };
fwrite(buf, 1, 4, stdout); // writes the bytes 1, 2, 0, 0
You could use fwrite(hello, 1, STR_LEN, stdout)
, but note that you're not allowed to read uninitialized data (so you should use calloc
instead or initialize the data in some other way).