Ask Your Question
0

saving this value

asked 2013-02-20 09:12:19 -0600

BMR gravatar image

updated 2013-02-21 00:35:47 -0600

double d = 5.5057787190877361e-001;
cout << setprecision(15) << fixed << d <<endl;

this prints 0.550577871908774

and instead of printing it, i need to save this value "0.550577871908774"

what i should to do ?

edit retag flag offensive close merge delete

Comments

This is not related with OpenCV. Have a look into a C++ book.

SR gravatar imageSR ( 2013-02-21 13:48:46 -0600 )edit

@SR : i know but i convert from matlab to open cv , and this question will help me in things related to open cv :)

BMR gravatar imageBMR ( 2013-02-22 10:03:42 -0600 )edit

1 answer

Sort by » oldest newest most voted
2

answered 2013-02-20 09:55:15 -0600

berak gravatar image

updated 2013-02-20 10:03:03 -0600

#include <fstream>

// write to file:
ofstream o("bla.txt");
double d = 5.5057787190877361e-001;
o << setprecision(15) << fixed << d <<endl;


// read back:
ifstream i("bla.txt");
double d;
i >> d;
edit flag offensive delete link more

Comments

Thanks alot :)

BMR gravatar imageBMR ( 2013-02-22 10:04:48 -0600 )edit

Question Tools

Stats

Asked: 2013-02-20 09:12:19 -0600

Seen: 399 times

Last updated: Feb 21 '13