Please , If I have a read_file object of fstream, and I want to read the postion that I am standing on without reading it . do I ise peek() ? I tried to use it , the first read returned 91 and the next returned 81 .
thank you.Code:#include <iostream.h> #include <fstream.h> int main(){ int x=0; ifstream bin_file("c:\\compiler_test\\bin.txt"); x = bin_file.peek(); cout << "the first read = " << x << endl; bin_file.get(); x = bin_file.peek(); cout << "the second read = " << x; return 0; }