getLine with two ifstream

I am new to C++ and wondering what is the standard for using std::getline()? Is there anything I should do if I want to work with two different ifstream? When I type the following code:

int main() {
  ifstream open("BigData.txt");
  string tmp;
  while(getline(open,tmp)){
    cout << tmp << endl;
  }
}

The code successfully read and print out strings in BigData.txt. But when I add another ifstream called input before ifstream open:

int main(){
  ifstream input("tmp.txt");
  string a;
  while(getline(input,a)){
    cout << a << endl;
  }
  ifstream open("BigData.txt");
  string tmp;
  while(getline(open,tmp)){
    cout << tmp << endl;
  }
}

It will not print anything for BigData.txt. May someone tell me why?


Complete Code looks like this:

int main(){
  ifstream input("dictionary.txt");
  string tmp;
  string text;
  vector<string> dict;
  while(getline(input,tmp)){
    dict.push_back(tmp);
  }
  ifstream input2("BigData.txt");
  while(getline(input2,text)){
        cout << text << endl;
}
}

Update: It works for small txt file but will not work for big txt file (about 500 MB), anyone can tell why?


Update: The code works if I use open.get(char) instead of reading line by line. But I still do not know why? Maybe the file is to big for getline to open? But why does it work when there is only one ifstream? (debug with gdb. The code get to getline, then stops for a sec then go to end of the code without printing)