I have no idea what you mean by this. (EDIT: OH, if you mean you're trying to use cout to print the characters themselves (as opposed to the numeric value of the characters), then yes that's probably garbage.) Let's suppose, for fun, that we have an array of six shorts, 0x1234, 0x2345, 0x3456, 0x789a, 0x89ab, and 0x9abc. From your perspective, it looks like this:
Originally Posted by Prediluted
so that pack is 0x1234, etc. When you pass that base address to your data thing, it gets reinterpreted as a bunch of characters, so now you have twelve bytes of this:
+--- base address of array
The byte-swapping is the endianness I mentioned before -- most modern computers are little-endian, meaning the least significant bytes are stored first. But in any event, that's what you should see on the other end of the pipe. Now what the other end of the pipe is going to do with the data I have no idea, but that's what it should see.
+---- base address
As to receiving, you first need to allocate memory for the buffer, then do something like
assuming the data you get is supposed to be interpreted as short ints.
short int *interpreted_data = (short int *)char_pointer_of_received_data;