Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <process.h>
- using namespace std;
- int main(int argc, char *argv[]) {
- cout << "argc = " << argc << endl;
- for (int i = 0; i < argc; i++) {
- cout << "Argument: " << i << " = " << argv[i] << endl;
- }
- if (argc != 2) {
- cout << "Error" << endl;
- exit(-1);
- }
- char ch;
- ifstream infile;
- infile.open(argv[1]);
- if (!infile) {
- cout << "errrrror: cant open a file" << argv[1];
- exit(-1);
- }
- while (infile) {
- infile.get(ch);
- cout << ch;
- }
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement