Actually there are a couple of problems with your code. One, as Omair pointed out, is that ptr is a char pointer so cout assumes it points to a null terminated string.
The second problem, again as Omair already pointed out, is that ptr[i] is a char and will be printed as the ASCII glyph rather than the value of the char. The solution is to convert it to an int.
Another problem is the type of the data. Since you declared ptr to point to char instead of unsigned char, the values will be sign extended. Any value greater than 7F will appear as FFFFFFxx (the number of proceeding FF's depends on the size of 'int' in your compiler / environment) because it is converted from signed char to unsigned int when it is printed.
One last problem (with Omair's solution) is that modern compilers (e.g. g++ -Wall) will complain about doing math on a void pointer. Therefore, you must do the math before converting ptr to a void pointer by enclosing the ptr + i in parens.
The complete corrected routine is shown below.
void print_bytes(myst *my_struct)
{
unsigned char *ptr = (unsigned char *)my_struct;
cout << std::hex;
for (size_t i = 0; i < sizeof(*my_struct); i++) {
cout << (const void *) (ptr + i) << ": " << (unsigned int) ptr[i] << "\n";
}
}