Vancouver wrote:
It is like scratching the right ear with the left hand. The file length is known and recorded somewhere during open. seekg with ios::end uses exactly that information - but how to get it directly?
I agree, a lit cumbersome, but your way isn't that cleaner..., moreover I don't like such hacking-like actions with class data members (only matter of style).
Vancouver wrote:
Btw, I don't understand, why to substract the position of file beginning; is there any case, when that is not zero?
'cause, AFAIK nowhere (documentation) is stated that tellg() will return 0 at the beginning of the file. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.