I am using getline to read a CSV file.

The line it reads looks something like

"1/24/2010 6:19 1/24/2010 6:59 Merrill - Valley Farms yhy 69 Vegetation 55"

The getline works but, I need to be able to calculate time days between a date the user inputs and the date here. AKA the first few characters in the line. I have tried to use assign and store them to arrays, which works great expect for sometimes the month is 1 or it could be 10, 11 or 12 and then assign does not work correctly.

I have also tried strchr which does not work. My code looks like this, I think the way is to use pointers, I have looked all over and I cannot find a way to do it, especially be able to find the second delimiter.

while (! lineseg.eof() && getline(lineseg,data).good() )
		if( (found=data.find (term[2],0)) !=string::npos && (found=data.find (voltage,0)) !=string::npos)
6 Years
Discussion Span
Last Post by JordanHam


I just added a 0 onto the front of the date I read in and then I will use assign

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.