Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7.  
  8. ifstream iFile("text.txt");
  9. iFile.seekg(6, ios::beg);
  10. char ch;
  11. iFile.get(ch);
  12. cout << ch << endl;
  13. iFile.seekg(-6, ios::end);
  14. iFile.get(ch);
  15. cout << ch << endl;
  16. iFile.seekg(3, ios::cur);
  17. iFile.get(ch);
  18. cout << ch << endl;
  19.  
  20. iFile.seekg(0, ios::end);
  21. cout << "size of file: " << iFile.tellg() << endl;
  22. iFile.close();
  23.  
  24.  
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement