Mail Archives: djgpp/1999/05/21/01:10:18
The following code fails to work. (using GCC 2.8.1 - its *cool*)
#include <iostream.h>
#include <fstream.h>
int main() {
fstream f("test");
f.peek();
cout << f.tellg() << " " << (char) f.get();
}
The file "test" contains the string ABCD.
The program incorrectly displays "1 B" instead of "0 A". (This behaviour
happens if peek() is called as above).
Anyone can suggest a workaround? (get() followed by putback() does
not help).
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
- Raw text -