Joining data from two files
Jan 11, 2017 at 9:36am
I am trying to join two files based on the DSL score. I am using the following code, but it si not working
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
int DSL_1[25000], sl[25000], NCT[25000], state[25000], RU[25000];
int DSL_2,sl_2, item, unit;
float Quant(5);
ifstream input_1("block_a.txt");
ifstream input_2("block_h_bc1.txt");
ofstream GAINS("merge_bc1.txt");
for(int i=0; i<25000; i++)
{
input_1>>DSL_1[i]>>sl[i]>>NCT[i]>>state[i]>>RU[i];
while(input_2>>DSL_2>>sl_2>>item>>unit>>Quant)
{
if(DSL_1[i] == DSL_2)
{
GAINS<<DSL_2<<'\t'<<state[i]<<'\t'<<item<<'\t'<<unit<<'\t'<<Quant<<endl;
}
}
}
|
Jan 11, 2017 at 10:43am
What is the problem?
Does it crash?
Does it write wrong results?
How does the file data look like?
Jan 12, 2017 at 5:13am
the output is dumping some error data, sometime it is following only one number in one column in the output file
Topic archived. No new replies allowed.