Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <sstream>
- #include <vector>
- using namespace std;
- int main(int argc, char* argv[])
- {
- if (argc!=3)
- {
- cerr<<"Error, need 2 arg"<<endl;
- return(-1);
- }
- int startInd, endInd;
- char semicolon;
- ifstream input(argv[1]);
- vector<char> buf;
- string strVector;
- stringstream str;
- if (input==0)
- {
- cerr<<argv[1]<<"Can't open to read"<<endl;
- return(-2);
- }
- str<<argv[2];
- if (!(str>>startInd>>semicolon>>endInd))
- {
- cerr<<"err"<<endl;
- return(-3);
- }
- if ((semicolon!='-') || (startInd>endInd) || (startInd<0) && (endInd<0))
- {
- cerr<<"err"<<endl;
- return(-4);
- }
- char c;
- while(input.get(c))
- {
- buf.push_back(c);
- /*if (buf.size()<endtInd)
- continue;
- for (int i=0; i<buf.size(); i++)
- {
- if ((i>=startInd) && (i<=endInd))
- {
- if ((int)buf[i]<32)
- {
- cout<<buf[i];
- }
- }
- else
- cout<<buf[i];
- }*/
- if(c=='/n'){
- cout<<"efe";
- for(int i=startInd;i<endInd;i++){
- if((int)buf[i]>32){
- buf.erase(buf.begin()+i);}
- }
- for(int i=0;i<buf.size();i++)
- cout<<buf[i];
- cout<<endl;
- buf.clear();
- }}
- input.close();
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement