Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <stdio.h>
- #include <cmath>
- #include <fstream>
- using namespace std;
- int main()
- {
- ofstream file("text.txt");
- if(!file){
- cout<<"Could not open the file.\n";
- return 1;
- }
- file << "abcdefg"<<endl;
- file.close();
- ifstream ifile("text.txt");
- if(!file){
- cout<<"Could not open\n";
- return 1;
- }
- cout<<"abcdefg"<<endl;
- ifile.seekg(0,ios::beg);
- cout<<ifile.tellg()<<endl;
- char ch;
- ifile >> ch;
- cout<<ch<<" "<<ifile.tellg()<<endl;
- ifile >> ch;
- cout<<ch<<" "<<ifile.tellg()<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement