//*********************************************
//test read and write operation in text file
//*********************************************

#include <iostream>
#include <fstream>
using namespace std;

//=============================================
int main(){
	char thought[300];
	char recThought[20];
	ofstream write("myThought");
	if(!write){
		cout<<"Error opening file\n";
		return 1;
	}
	cout<<"insert your thought(press 'x' to finish)\n";
	cin>>thought;
	write<<thought;
	write.close();
	ifstream read("myThought");
	if(!read){
		cout<<"Error opening file\n";
		return 1;
	}
	read>>recThought;
	cout<<recThought<<endl;
	read.close();
	return 0;
}