According to task description you must output 9 bytes of stock name. 
sizeof(char) * _message_size = 8 bytes.
Right code is:
stream.write( reinterpret_cast<char*> (&stock_name), sizeof( stock_name ) );