Good afternoon,
I'm attempting to get some old-fashioned code to function in g++ 4.4. My understanding is the code compiled fine in g++ 4.0, but g++ has become more strict between 4.0 and 4.4. This code in particular causes the compiler to stop and complain:
sprintf(s,"%.7d",(long)tellp());
tellp() is a std::streampos object. The above call to sprintf occurs inside a derived class from a std::fstream class.
The code intends to cast data that indicates the position in an fstream object to a numerical type, so that it can be passed to a 2nd running program (via a file) so that the 2nd program can quickly look-up some data in a file.
Is there a simple way to rescue this, with a cast g++ would be happy with?
The error message:
error: format ‘%.7d’ expects type ‘int’, but argument 3 has type ‘std::streamoff’