I have a csv file that has 12 columns. I've been using:

while(!infile.eof())
			{
				getline( infile, source, ',' );
				outfile << source << ", ";
				
				getline( infile, native_ID, ',' );
				outfile << native_ID << ", ";
				
				getline( infile, index, ',' );
				outfile << index << ", ";
				
				getline( infile, charge, ',' );
				outfile << charge << ", ";
				
				getline( infile, cluster_ID, ',' );
				outfile << cluster_ID << ", ";
				
				getline( infile, fdr, ',' );
				outfile << fdr << ", ";
				
				getline( infile, precursor_mass	, ',' );
				outfile << precursor_mass << ", ";
				
				getline( infile, calculated_Mass, ',' );
				outfile << calculated_Mass << ", ";
				
				getline( infile, mass_Error, ',' );
				outfile << mass_Error << ", ";
				
				getline( infile, peptide, ',' );
				outfile << peptide << ", ";
				
				getline(infile, mods, ',');
				outfile << mods << ", ";
				
				getline( infile,  search_Scores, '\n' );
				outfile << search_Scores << "\n";
			}

to grab the values from each column, and then output it in another file. I need
to pass each value for peptide into another function named Calling_Function, and then output values from calling_function into the 13th column of the output file. I'm having problems passing each value to calling_function, and only the first value is being passed. Where should I place calling function in the above code, and how can I make it read each value, not just the first value? It also seems that the while loop is only iterating once, b/c if I put a cout in there, it only shows up once. But the getline is somehow able to copy all of values for the columns and not just the first, though its only looping once?

Here is the callfunction

float pI_estimate = Calling_Function(peptide, start_pH, end_pH);

start and end are predefined elsehwer in the program

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.