Here is how I understand your question. You have a file test.txt
:
time freq
0.001 12.3
0.002 12.5
0.003 12.7
0.004 13.4
Then you want to read in this file, so that you have time
in one container and freq
in the other for further processing. If so then your program is like that:
#include<iostream>
using namespace std;
int main()
{
ifstream in_file("test.txt");
string label1, label2;
float val;
in_file >> label1; //"time"
in_file >> label2; // "freq"
vector<float> time;
vector<float> freq;
while (in_file >> val)
{
time.pushback(val);
in_file >> val;
freq.pushback(val);
}
}