dumb classes

Hi,
Is there a member function in the classes that operate on file streams that simply returns the size of the file ? if not, why don't they just implement such a functionality ? I remember reading this piece of review on C style array and the author of that article considered them "dumb" since they don't even know how many elements they contain !!. So, aren't file streams dumb as well since they don't even know the size of the file they are incorporated with ?
I know how to do that, what I'm saying is that why isn't there something like vector::size that gives the size of the file
A file might not have actual size,or can be even not a file at all. So for maximum abstraction file streams lack size() member. We expect Filesystem TS be included in C++1z which will have crossplatfor ability to get file size. For now use Boost.
An fstream contains only functionality concerning IO operations. It doesn't hold data from the file at all, only associates with it. A size() function wouldn't be the same as a size() function like from an std::array or std::vector.
The standard doesn't define fstreams as "file streams" in that context. file streams are just streams. They aren't "files", so when you get the "size" of the stream, it isn't garunteed to be the "size" of the file; it's only garunteed to be the size of the stream.
Topic archived. No new replies allowed.