OOCP4-8

//BCA Support //www.bcasupport.xyz #include <iostream.h> #include <conio.h> #include <fstream.h> int main() { long p,g; clrscr(); fstream fin("file.txt",ios::in); fstream fout("file.txt",ios::out); p=fout.tellp(); g=fin.tellg(); cout<<"\nPointer position : "<<p<<" "<<g; fout<<"BCA-Support"; cout<<"\n> Data written to file\n"; p=fout.tellp(); g=fin.tellg(); cout<<"\n1. Pointer position : "<<p<<" "<<g; fout.seekp(-5,ios::end); fin.seekg(-7,ios::end); p=fout.tellp(); g=fin.tellg(); cout<<"\n2. Pointer position : "<<p<<" "<<g; char data[10]; fin>>data; cout << "\n> Data : "<<data; fout.seekp(3,ios::beg); fin.seekg(2,ios::beg); p=fout.tellp(); g=fin.tellg(); cout<<"\n3. Pointer position : "<<p<<" " <<g; fout.seekp(5,ios::cur); fin.seekg(2,ios::cur); p=fout.tellp(); g=fin.tellg(); cout<<"\n4. Pointer position : "<<p<<" " <<g; fout.seekp(0,ios::end); fin.seekg(0,ios::end); p=fout.tellp(); g=fin.tellg(); cout<<"\n5. Pointer position : "<<p<<" " <<g; getch(); return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.