// 22_22-9.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <fstream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	ifstream fin;
	char ch;

	fin.open("smpfile.txt");	// ファイルオープンする
	if (!fin) {
		return 1;
	}

	while (fin.get(ch)) {
		cout << ch;
	}

	fin.clear();	// フラグクリアしないと以下が動かない
	fin.seekg(0, ios_base::beg);

	while (fin.get(ch)) {
		cout << ch;
	}

	fin.close();

	MessageBox(NULL, _T("Check Console Window"), L"MessageBox", MB_OK);

	return 0;
}

