Commtech wireless Mercury 8-Line Instrukcja Użytkownika Strona 104

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 124
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 103
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
Przeglądanie stron 103
1 2 ... 99 100 101 102 103 104 105 106 107 108 109 ... 123 124

Komentarze do niniejszej Instrukcji

Brak uwag