[Boost-bugs] [Boost C++ Libraries] #4823: tellg () function of ifstream object is returning -1 for /proc virtual file system files.

Subject: [Boost-bugs] [Boost C++ Libraries] #4823: tellg () function of ifstream object is returning -1 for /proc virtual file system files.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-11-08 20:05:39


#4823: tellg () function of ifstream object is returning -1 for /proc virtual file
system files.
---------------------------------+------------------------------------------
 Reporter: pmanth2@… | Owner: bemandawes
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: |
---------------------------------+------------------------------------------
 The tellg function of ifstream object is returning -1 when the position
 of file pointer is queried for /proc virtual file system files. Below is
 the example program to demonstrate the problem

 #include <iostream
 #include <fstream>
 using namespace std;

 int main( int argc, char* argv[] ){
   long begin,end;
   ifstream myfile (argv[1]);
   begin = myfile.tellg();
   cout << " begin " << begin << endl;
   myfile.seekg (0, ios::end);
   end = myfile.tellg();
   myfile.close();
   cout << "size is: " << (end-begin) << " bytes.\n";
   return 0;
 }

 pmanth2_at_cyder:~$ ./fstream partA.cpp ( Normal text file )
  begin 0
 size is: 6692 bytes.


 pmanth2_at_cyder:~$ ./fstream /proc/cpuinfo ( virtual file system file )
  begin 0
 size is: -1 bytes.

 The tellg() should return the file pointer location for /proc file system
 files also.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4823>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC