#include<iostream>
using namespace std;
int main(){
int i;
float f=-6.9072;
//将float指针转换为字符指针
unsigned char* p=reinterpret_cast<unsigned char*>(&f);
cout<<hex;//print bytes of f in hex
for(i=0; i<sizeof(float);i++)
cout<<static_cast<int>(p[i])<<endl;
}
原文:http://blog.csdn.net/slience_perseverance/article/details/19724931