User manual
ECE 477 Final Report Spring 2004
Menu Editor (C++)
/* Name: Jon Hopp
Compiler/OS Used: gcc UNIX
ECE 477 Group 5 - Simple Menu Editor
*/
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <string>
#define CHARMAX 20
#define ITEMMAX 16
#define CATMAX 3
using namespace std;
string openTextFile( string filename ) {
string s1 ="";
// converts the string into a char*
const char* newname = filename.c_str();
// opens the file to the editor
ifstream from( newname );
if ( !from ) {
cout << "Cannot open input file: " << filename << endl;
return ("");
}
char ch;
while ( from.get( ch ) )
s1 += ch;
from.close();
return s1;
} // openTextFile()
void saveTextFile( string text, string filename ) {
// converts the string into a char*
const char* newname = filename.c_str();
//saves file
ofstream from( newname );
if ( !from )
cout<< "Cannot open output file: " << filename << endl;
from << text;
from.close();
return;
F-30