What kind of errors would cause tellg() to give a position of -1? I've tried searching for this on Google but didn't have much luck. I know a value of -1 means failure but I don't know what are the typical causes of failure.
What kind of errors would cause tellg() to give a position of -1? I've tried searching for this on Google but didn't have much luck. I know a value of -1 means failure but I don't know what are the typical causes of failure.
Last edited by waterborne; 06-23-2010 at 04:43 PM.
Not opening the file.
Seeking on a device / pipe / other things which are not seekable.
Reading the manual page for tellg() and looking at the return result description.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.