출처: http://www.cplusplus.com/forum/beginner/25121/

출처: http://www.daniweb.com/software-development/cpp/threads/143575/an-equivalent-to-a-vectorifstream-member-variable



vector<ifstream*> 과 같이 사용하면 괜춘!


  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <fstream>
  5. using namespace std;
  6. void foo(ifstream& in)
  7. {
  8. }
  9. int main()
  10. {
  11. vector<ifstream*> streams;
  12. for(size_t i = 0; i < 5; i++)
  13. {
  14. ifstream* in = new ifstream;
  15. streams.push_back(in);
  16. streams[i]->open("filename.txt");
  17. }
  18. foo( *streams[1] );
  19. }

Posted by halloRa
,