Advertisement
Guest User

Untitled

a guest
Jan 15th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <string>
  2. #include <fstream>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     // Открываем в режиме чтения, записи и с конца файла
  10.     fstream inOut ("copyOut.txt", fstream::in | fstream::out);
  11.  
  12.     if (!inOut) {
  13.         cerr << "Unable to open file!" << endl;
  14.         return EXIT_FAILURE;
  15.     }
  16.  
  17.     string s;
  18.     fpos<int> mark;
  19.  
  20.     while (getline(inOut, s)) {
  21.            cout << "Line: " << s << endl;
  22.            mark = inOut.tellg();
  23.            cout << "Mark: " << mark << endl;
  24.     }
  25.  
  26.  
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement