// 23_23-3.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <sstream>
#include <string>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	stringstream stio;
	string ss;
	int idt = 255;
	double ddt = 1234.56;

	cout << "-----入出力ストリームに書き込む\n";
	stio << "aaaa\n";
	stio << "bbbb\n";
	stio << idt << " " << hex << idt << '\n';
	stio << ddt << " " << scientific << ddt << '\n';

	cout << "-----入出力ストリーム内容をstr()で表示する\n";
	cout << stio.str();

	cout << "-----先頭から文字列として読み込む\n";
	stio.seekg(0, ios_base::beg);
	while (stio >> ss) {
		cout << ss << '\n';
	}
	stio.clear();

	cout << "-----入出力ストリーム内容を文字列で再設定して読み込む\n";
	stio.str("AAAA BBBB CCCC");
	while (stio >> ss) {
		cout << ss << '\n';
	}
	
	MessageBox(NULL, _T("Check Console Window"), L"MessageBox", MB_OK);

	return 0;
}

