translator.cpp
/*
 * Translate the file
 * Parameters: File name to translate
 * Return value: true if the file is successfully translated
 */
Translate the file
Parameters: File name to translate
Return value: true if the file is successfully translated
Translate the file Parameters : File name to translate Return value : true if the file is successfully translated
bool translator::translate_file(char *file) {
	cout << " Translating " << file << endl;
	wstring line;
	wifstream infile(file);
	wofstream outfile((string(file) + string(".temp")));
	if (infile.is_open()) {
		while (getline(infile, line)) {
			line = process(line);
			outfile << line << endl;
		}
		infile.close();
		outfile.close();
		if (save_backup)
			rename(file, (string(file) + suffix).c_str());
		rename((string(file) + string(".temp")).c_str(), file);
		remove((string(file) + string(".temp")).c_str());
	}
	else
		cout << "Unable to open file";
	cout << "Translating " << file << " was successful." << endl;
	return true;
}
bool translator :: translate_file ( char * file ) { cout << " " << file << endl ; wstring line ; wifstream infile ( file ) ; wofstream outfile ( ( string ( file ) + string ( " " ) ) ) ; if ( infile . is_open ( ) ) { while ( getline ( infile , line ) ) { line = process ( line ) ; outfile << line << endl ; } infile . close ( ) ; outfile . close ( ) ; if ( save_backup ) rename ( file , ( string ( file ) + suffix ) . c_str ( ) ) ; rename ( ( string ( file ) + string ( " " ) ) . c_str ( ) , file ) ; remove ( ( string ( file ) + string ( " " ) ) . c_str ( ) ) ; } else cout << " " ; cout << " " << file << " " << endl ; return true ; }
Translate the file
 Parameters: File name to translate
 Return value: true if the file is successfully translated
Translate the file Parameters : File name to translate Return value : true if the file is successfully translated