fixed in output stream not recognized

LLeweLLyn Reese llewelly@lifesupport.shutdown.com
Wed Mar 26 20:30:00 GMT 2003


John Love-Jensen <eljay@adobe.com> writes:

> Hi Frank,
> 
> Worked for me.  Hmmm.

Using gcc 2.96 ? I don't think so. It certainly doesn't work on my
    gcc 2.96 (i586-mandrake-linux-gnu).

It does work on 3.x, however, as the OP noted - but 2.96 didn't
    support it.

> 
> #include <iomanip>
>   using std::fixed;
> 
> #include <fstream>
>   using std::ofstream;
> 
> #include <string>
>   using std::string;
> 
> void Foo(const string& filename) {
>   double d = 3.3;
>   ofstream file(filename.c_str());
>   file.precision(0);
>   file << fixed << d;
> }
> 
> --Eljay



More information about the Gcc-help mailing list