/*
*Copyright (c) 2016 烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:test.cpp
*作 者:史红浩
*完成日期:2016年 6 月 16 日
*问题描述:阅读程序,查看输出结果
*版 本 号:v1.0
*/
#include <iostream>
#include <fstream>
using namespace std;
int main( )
{
unsigned char a[] = {0xD4,0xB8,0xB7,0xAD,0xD7,0xAA,0xB5,0xC4,0x43,0x2B,
0x2B,0xBF,0xCE,0xCC,0xC3,0xCE,0xAA,0xC4,0xE3,0xB4,
0xF8,0xC0,0xB4,0xD1,0xA7,0xCF,0xB0,0xB7,0xBD,0xB7,
0xA8,0xB5,0xC4,0xB8,0xC4,0xB1,0xE4,0xA3,0xA1
};
ofstream outfile("f3.dat",ios::out|ios::binary);
outfile.write((char*)a, sizeof(a));
outfile.close();
return 0;
}
运行程序之后,在当前目录建立了一个DAT文件 文件内容为:
0xD4,0xB8,0xB7,0xAD,0xD7,0xAA,0xB5,0xC4,0x43,0x2B, 0x2B,0xBF,0xCE,0xCC,0xC3,0xCE,0xAA,0xC4,0xE3,0xB4, 0xF8,0xC0,0xB4,0xD1,0xA7,0xCF,0xB0,0xB7,0xBD,0xB7, 0xA8,0xB5,0xC4,0xB8,0xC4,0xB1,0xE4,0xA3,0xA1 编译后变成文字:愿翻转的C++课堂为你带来学习方法的改变!