Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. filebuf inFileBuf;
  8.  
  9. if (inFileBuf.open("text.dat", ios_base::in) == nullptr) {
  10. cout << "File 'text.dat' is not existing";
  11.  
  12. return 0;
  13. }
  14.  
  15. istream inFileStream(&inFileBuf);
  16.  
  17. while (true) {
  18. char c = inFileStream.get();
  19.  
  20. if (c == EOF)
  21. break;
  22.  
  23. cout << c;
  24. }
  25.  
  26.  
  27.  
  28. inFileBuf.close();
  29.  
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement