Thread: Weird file position

  1. #1
    Registered User
    Join Date
    Dec 2009

    Weird file position

    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.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM