Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <iostream>
- #include <fstream>
- #define MAX 256
- using namespace std;
- int main(int argc, char** argv)
- {
- FILE *fp;
- char buf;
- int max, min, n=0;
- char ch;
- if(argc<3)
- { cout << "Wrong arguments" << endl; exit (-1);}
- sscanf(argv[2], "%d%*c%d;", &min, &max);
- if (( max < min) || (min<0) || (max>255)) { cout << "error range"<< endl; exit(-1); }
- ifstream in (argv[1]);
- if(!in)
- { fprintf(stderr, "Cannot open file\n"); return 0; }
- while (in){
- in.getline(ch);
- if(in) { buf = ch; n++; cout << (int)buf << " " << (int)ch <<endl;
- }}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement