Advertisement
Guest User

Untitled

a guest
May 24th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. int main()
  5. {
  6.     std::ifstream file("numbers.txt", std::ios::in);
  7.     if (!file)
  8.     {
  9.         std::cerr << "Can't open file\n";
  10.         return 1;
  11.     }
  12.     char ch;
  13.     while (!file.eof())
  14.     {
  15.         file.get(ch);
  16.         if (!file.good() && !file.eof())
  17.         {
  18.             std::cout << "I/O error!\n";
  19.             return 1;
  20.         }
  21.         std::cout << ch;
  22.     }
  23.     std::cout<<std::endl;
  24.     return 0;
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement