#include #include using namespace std; // Here is the input file with ruler lines. // // 11111111112222222222 // 012345678901234567890123456789 // abcdefghijklmnopqrstuvwxyzRNE // // R is the carriage return character, ascii code = 13. // N is the new line character, ascii code = 10. // E is the end of file position from which the // ios::cur offset is computed. // // The ios::end position is at byte 26. int main() { ifstream fin("alphabet.txt", ios::in | ios::binary); char x; fin.seekg(2, ios::beg); fin >> x; cout << x; fin.seekg(3, ios::cur); fin >> x; cout << x; fin.seekg(-5, ios::end); fin >> x; cout << x; fin.seekg(-4, ios::cur); fin >> x; cout << x; fin.seekg(16, ios::beg); fin >> x; cout << x << endl; return EXIT_SUCCESS; } // Output: // cgxuq