1,105,546 Community Members

Splitting read input from getline.

Member Avatar
JordanHam
Light Poster
41 posts since Jan 2011
Reputation Points: -2 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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)
		{
			
		}}
Member Avatar
JordanHam
Light Poster
41 posts since Jan 2011
Reputation Points: -2 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

nevermind

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

Question Self-Answered as of 3 Years Ago
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: