C plus plus中的分配和引用错误?

I want to re-arrange a text file from one format to another. For a smaller size .txt file, the code works perfect but for a larger one, I get the error on the picture. Can someone please share some light on how to solve this error?enter image description here

我的主要功能如下:

int main() {   
  ifstream input;
  ofstream output;
  char filename[100];   
  cin.getline(filename,100);
  input.open(filename);  
  string str;
  vector<string> event;   
  while(getline(input,str)){   
    if(str[1]!='-'){
       event.push_back(str);
    }
    else{
        if(!event.empty()){
            getMax(event);
        }
    }
  }
  //event.clear();
  cout << "Hello" <<endl;
  //Creating the header for output file
  string hstring = "";
  for(int i=1;i<BjetMax+1;i++){
     for(int j=1;j<5;j++){
        hstring = hstring + "Bjet" + to_string(i) + to_string(j) + ",";
     }
  }    
   for(int i=1;i<LeptonsMax+1;i++){
     for(int j=1;j<4;j++){
        hstring = hstring + "Leptons" + to_string(i) + to_string(j) + ",";
     }
  }   
  for(int i=1;i<LightjetMax+1;i++){
     for(int j=1;j<5;j++){
        hstring = hstring + "Lightjet" + to_string(i) + to_string(j) + ",";
     }
  }    
  hstring += "MET";
  output << hstring << endl;
  cout << hstring << endl;
  input.close();
  input.open(filename);    
  cout << "BjetMax " << BjetMax << endl;
  cout << "LightjetMax " << LightjetMax << endl;
  cout << "LeptonsMax " << LeptonsMax << endl;    
  while(getline(input,str)){
    if(str[1]!='-'){
       event.push_back(str);
    }
    else{
        if(!event.empty()){
            getCount(event);
            sort(event.begin(),event.end());
            event = removeNotDigits(event);
            output<< makeLine(event) << endl;
            event.clear();
        }
    }
  }   
  input.close();
  output.close();  
  return 0;
}
评论