// 22_22-5.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <fstream>
#include <iomanip>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	ifstream fin;
	int ch;
	int ct;

	if (argc != 2) {
		cout << "入力誤り\n";
		return 1;
	}

	fin.open(argv[1], ios_base::in | ios_base::binary);
	if (!fin) {
		cout << argv[1] << "をオープンできません\n";
		return 1;
	}

	cout << hex << uppercase << setfill('0');

	ct = 0;
	while ((ch = fin.get()) != EOF) {
		cout << setw(2) << ch << ' ';
		if (++ct % 16 == 0) {
			cout << '\n';
		}
	}
	cout << '\n';
	fin.close();


	MessageBox(NULL, _T("Check Console Window"), L"MessageBox", MB_OK);

	return 0;
}

