R
Rakesh Sinha
Hello,
I am writing this application for which I need to determine the file
size.
My code looks roughly as follows.
#include <fstream>
#include <iostream>
using std::ifstream;
ifstream fp;
fp.open("myfile", ios::binary);
ifp.seekg(0, ios::end);
pos_type length = ifp.tellg();
//Process with length
std::cout << "Length of file " << length << std::endl;
My problem is where is pos_type defined ? I can make an approximation
like unsigned long instead of it to get around , but I would not like
to do that.
I referred to the C++ 2003 standards and here is what I had found it
then.
[lib.ios] 27.4.4
namespace std {
..
class basic_ios : public ios_base {
public:
// Types:
typedef typename traits:os_type pos_type;
};
}
How would I use this type in my program ?
I am writing this application for which I need to determine the file
size.
My code looks roughly as follows.
#include <fstream>
#include <iostream>
using std::ifstream;
ifstream fp;
fp.open("myfile", ios::binary);
ifp.seekg(0, ios::end);
pos_type length = ifp.tellg();
//Process with length
std::cout << "Length of file " << length << std::endl;
My problem is where is pos_type defined ? I can make an approximation
like unsigned long instead of it to get around , but I would not like
to do that.
I referred to the C++ 2003 standards and here is what I had found it
then.
[lib.ios] 27.4.4
namespace std {
..
class basic_ios : public ios_base {
public:
// Types:
typedef typename traits:os_type pos_type;
};
}
How would I use this type in my program ?