Weird file position

This is a discussion on Weird file position within the C++ Programming forums, part of the General Programming Boards category; What kind of errors would cause tellg() to give a position of -1? I've tried searching for this on Google ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Location
    Colorado
    Posts
    41

    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 05:43 PM.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,762
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 11: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, 01:44 PM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 04:39 AM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 11:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21