Need help - No Rounding by writing

Hey,

i have a problem.
A Short overview over my programm:

1.I load mess values from different files
2.I compare & modify them
3.I want to write all into one file

I have problems in step 3.

My Code for this point:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	std::ofstream outfile;                // Output-Datei intiallisieren
	std::stringstream out_data;
	out_data<<filename.str()<<"all.txt"; // File zum Speichern
	outfile.open (out_data.str(), ios_base::app);	
	int h=0;

	// Alles in eine Datei! 
	for (int i=0; i<(channel_max+1); i++)
		{	std::ifstream infile;       // Input-Datei initialisieren
			std::stringstream raw_data;
			if (i<10)
				{raw_data.str("");
				raw_data<<filename.str()<<"0"<<i<<".list";} //Filename zum Laden
			else
				{raw_data.str("");
				raw_data<<filename.str()<<i<<".list";}
			std::cout <<raw_data.str() << "\n" ;
			infile.open (raw_data.str());
			h=i;
			while (check<1)
			{	double a=0,b,c; 
				infile>>a>>b>>c;
				/*if (i/8<1)
					timestemp=a;
				if (i/8<2 && i/8>0.99)
					timestemp=a+t_offset12;
				if (i/8<3 && i/8>1.99)
					timestemp=a+t_offset13;
				if (i/8<4 && i/8>2.99)
					timestemp=a+t_offset14;
				if (i/8<5 && i/8>3.99)
					timestemp=a+t_offset15;
				if (i/8<6 && i/8>4.99)
					timestemp=a+t_offset12; */
				if (h<1.5)
					{timestemp=a;}
				if (h<2.5 && h>1.5)
				{timestemp=a+t_offset12;}
				 if (h<3.5 && h>2.5)
				{timestemp=a+t_offset13;}
				if (h<4.5 && h>3.5)
				{timestemp=a+t_offset14;}
				if (h<5.5 && h>4.5)
				{timestemp=a+t_offset15;}
				if (h<6.5 && h>5.5)
					{timestemp=a+t_offset16;}
				if (a>0)
				{outfile << timestemp << "\t" << b <<"\t"<< c << "\t" << i << "\n" ;} // Schreiben der Outputdatei Reihenfolge [ t sg lg # ]
				else
					{check=1;} 
			}
			infile.close();
			check=0;
	}
	outfile.close();


I only have the problem, the double timestemp is rounded in the outfile so i can't sort them after finishing! The Timestemp has 13-14 numbers.

How can i fix this problem?

Thanks!
Last edited on
Topic archived. No new replies allowed.