#include #include using namespace std; int main(int argc, char** argv){ if(argc < 2){ cout << "出力ファイルを指定して下さい" << endl; } ofstream ofs(argv[1]); char c = 100; short s = 10000; int i = 1000000; long l = 100000000; cout.setf(ios::hex, ios::basefield); cout << (short)c << endl; cout << s << endl; cout << i << endl; cout << l << endl; ofs.write(&c, 1); ofs.write((char *)&s, 2); ofs.write((char *)&i, 4); ofs.write((char *)&l, 8); }