#include #include using namespace std; int main ( int argc, char* argv[] ) { char inbuffer[8]; ifstream in("passwd.dat"); //sequential input from random file cout << in.tellg() << endl; in.read(inbuffer, sizeof(inbuffer)); cout << inbuffer << endl; cout << in.tellg() << endl; in.read(inbuffer, sizeof(inbuffer)); cout << inbuffer << endl; cout << in.tellg() << endl; //random input from random file int where=0; cout<< "input 0 or 8: "; cin >>where; while(where==0 or where==8) { in.seekg(where, ios::beg); cout << in.tellg() << endl; in.read(inbuffer, sizeof(inbuffer)); cout << inbuffer << endl; cout << in.tellg() << endl; cout<< "input 0 or 8: "; cin >>where; } in.close(); return 0; }