Setting precision to an output text file in C++

  • Thread starter Thread starter sandeep
  • Start date Start date
Joined
11/28/06
Messages
31
Points
18
Hi,
I am facing a problem in C++. I am trying to set the precision (for the results-matrix elements) in the output text file, which doesn't seem to be working. The command which I am using is follows:

ofstream myfile("output.txt");
myfile.precision(14);

Could anybody suggest where am I going wrong?

thanks
Sandeep
 
Hm. I've used this and it seems to have worked in the past:

outFile.precision(2);
outFile.setf(ios::fixed);
outFile.setf(ios::showpoint);
 
Back
Top Bottom