954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Passing values from getline

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?

emmonssw
Newbie Poster
4 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

Here is the callfunction

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

start and end are predefined elsehwer in the program

emmonssw
Newbie Poster
4 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: