main.cpp
来自「数据结构与程序设计教材源码 数据结构与程序设计教材源码」· C++ 代码 · 共 44 行
CPP
44 行
#include <stdlib.h>
#include <string.h>
#include "../../C/UTILITY.H"
#include "../../C/UTILITY.CPP"
#include "../DOUBLY/LIST.H"
#include "../DOUBLY/LIST.CPP"
#include "../STRINGS/STRING.H"
#include "../STRINGS/STRING.CPP"
#include "EDITOR.H"
#include "EDITOR.CPP"
int main(int argc, char *argv[]) // count, values of command-line arguments
/*
Pre: Names of input and output files are given as command-line arguments.
Post: Reads an input file that contains lines (character strings),
performs simple editing operations on the lines, and
writes the edited version to the output file.
Uses: methods of class Editor
*/
{
if (argc != 3) {
cout << "Usage:\n\t edit inputfile outputfile" << endl;
exit (1);
}
ifstream file_in(argv[1]); // Declare and open the input stream.
if (file_in == 0) {
cout << "Can't open input file " << argv[1] << endl;
exit (1);
}
ofstream file_out(argv[2]); // Declare and open the output stream.
if (file_out == 0) {
cout << "Can't open output file " << argv[2] << endl;
exit (1);
}
Editor buffer(&file_in, &file_out);
while (buffer.get_command())
buffer.run_command();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?