I am feeling very confused about this issue. What I want to do is to
write a member function that will return the size of an std::fstream.
I have this:
const std::streampos getFileSize() {
// get file size
std::streampos file_size;
std::streampos currentpos = f.tellg();
f.seekg (0, std::ios::end);
file_size = f.tellg();
f.seekg (currentpos);
return file_size;
}
'std::istream::tellg()' would work if I open the stream for input, but
would it work if I open the stream for output?
I want to avoid having to write two member functions, one for
'std::istream' and another for 'std::ostream'. Is this possible?
--
FYI
http://www.astro.umd.edu/~marshall/abbrev.html
E-Mail Policy
http://www.vif.com/users/escalante/Email_Policy.html
* You cannot exercise your power to a point of humiliation.
- Jean Chretien
* The media's the most powerful entity on earth. They have the
power to make the innocent guilty and to make the guilty
innocent, and that's power.
- Malcom X
* "Innocent until proven guilty", no... not in Canada!!
|