Advertisement
Guest User

PooPooDooDoo

a guest
Oct 22nd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. void openInput(ifstream& inFile)
  2. {
  3.  
  4. string inputFile;
  5.  
  6. while(true)
  7. {
  8. cout<<endl;
  9. cout<<"Enter name of input file or Control-C to quit program: ";
  10. cin>>inputFile;
  11. cout<<inputFile<<endl;
  12. cout<<endl;
  13.  
  14. inFile.open(inputFile.c_str());
  15.  
  16. if(inFile.fail())
  17. {
  18. cout<<"*************** File Open Error ***************"<<endl;
  19. cout<<"==> Input file failed to open properly!!"<<endl;
  20. cout<<"==> Attempted to open file: "<<inputFile<<endl;
  21. cout<<"==> Please try again..."<<endl;
  22. cout<<"***********************************************"<<endl;
  23. }
  24. else
  25. {
  26. break;
  27. }
  28. }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement