Code:#include <iostream> #include <fstream> #include <cstdlib> #include <cstring> #define MAX 256 using std::ofstream; using std::ifstream; using std::cout; using std::cerr; using std::cin; using std::endl; using std::string; void FilePrint( ofstream& output, string strFile, string strText ) { output.open( strFile.c_str() ); if( !output.is_open() ) { cerr << "Unable To Open: " << strFile.c_str() << endl; exit(1); } else { output << strText.c_str() << endl; } output.close(); } void FileGet( ifstream& input, string strFile, char *cBuffer, const int SIZE ) { input.open( strFile.c_str() ); if( !input.is_open() ) { cerr << "Unable To Open: " << strFile.c_str() << endl; exit(1); } else { while( !input.eof() ) { input.getline( cBuffer, SIZE ); cout << cBuffer << endl; } } input.close(); } int main( int argc, char *argv[] ) { ofstream fout; ifstream fin; char Buffer[MAX]; FilePrint( fout, "Example.txt", "Hello World!!\nHow Are You Today?!" ); FileGet( fin, "Example.txt", Buffer, MAX ); cin.get(); return EXIT_SUCCESS; }