I have a strange problem on my gcc 3.2.2 installed in my SuSE Linux box. It does not compile a simple source file containing fpos_t. Strange. Am I missing some thing? It gives me error invalid initializer fpos_t
Thanks Salem for the reply. fpos_t is typede'd to long is Sun Solaris but I find that on my Linux it is typedef'd to __c_streampos; On my Sun machine I could use code like
fpos_t obj;
if (!obj) {...}
But this does not seem to be the right approach with __c_streampos? Could you suggest an alternative to the unary exclamation mark please?
> if (!obj) {...}
OK, I suppose on your Sun box, it's basically the same as
[tt]if ( obj == 0 )[/tt]
which I suppose could be taken to mean "the beginning of the file".
Perhaps a better way of determining whether you are at the beginning of the file.
This is a bit of a hack, since it's mixing old-style file positioning with new-style file positioning.
Code:
if ( ftell( fp ) == 0 ) /* was if (!obj) */
But then again, there is no fpos_t equivalent of fseek()
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.