Stephen
2009-02-21 19:12:26 UTC
Hello,
I am trying to write a program that will read a text file of numbers
from a data acquisition system into three vectors. The file produced
looks like this:
+0.0000000e+0 +2.7645134e+1 +2.7745625e+1
+0.4100041e-1 +2.7637787e+1 +2.7731047e+1
+0.0820008e+0 +2.7645134e+1 +2.7750483e+1
...
Once I open the file I try to collect the numbers like this:
vector<double> timeVec;
vector<double> ch1Vec;
vector<double> ch2Vec;
double n = 0;
while ( !inFile.eof() ) {
inFile >> n;
timeVec.push_back(n);
inFile >> n;
ch1Vec.push_back(n);
inFile >> n;
ch2Vec.push_back(n);
}
However, this gives me errors such as "*** glibc detected *** ./
response.o: double free or corruption" or fragmentation error. I have
not been able to find a way to read these numbers that works.
Thanks
I am trying to write a program that will read a text file of numbers
from a data acquisition system into three vectors. The file produced
looks like this:
+0.0000000e+0 +2.7645134e+1 +2.7745625e+1
+0.4100041e-1 +2.7637787e+1 +2.7731047e+1
+0.0820008e+0 +2.7645134e+1 +2.7750483e+1
...
Once I open the file I try to collect the numbers like this:
vector<double> timeVec;
vector<double> ch1Vec;
vector<double> ch2Vec;
double n = 0;
while ( !inFile.eof() ) {
inFile >> n;
timeVec.push_back(n);
inFile >> n;
ch1Vec.push_back(n);
inFile >> n;
ch2Vec.push_back(n);
}
However, this gives me errors such as "*** glibc detected *** ./
response.o: double free or corruption" or fragmentation error. I have
not been able to find a way to read these numbers that works.
Thanks
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]