I need to print packaged binary data to stdout in C++. Are there any STL libraries that can accomplish this? I know perl has this functionality but I need to be able to do it in only C++. If c++ does not have this functionality can someone please guide me on how I would go about programming something like this. Thank you.
+1
A:
This is typically how you would write arbitrary data to stdout in C (this works for C++ too):
char *binary_data; // initialise this to point to your data
size_t binary_data_length;
size_t n = fwrite(binary_data, 1, binary_data_length, stdout);
// check n to make sure that all requested bytes were written
Greg Hewgill
2010-01-25 00:17:53