-1

I have an incoming stream of strings coming in from a com port, It is in CSV format with a space between each set of data for example.

-123,231,23.2,1,1,1,1,1 -234,214,211,1,1,1,1,1 234,432,345,1,1,1,0,1

this reads up to a buffer limit of 500. what i need to do is place this data into an array being split at the space, delete the first and last elements in case they are not complete, and then further split the elements at the ",".Im having issues with what type of array to place them in and then how to delete the first and last elements.

Spriggsy
  • 196
  • 1
  • 18

1 Answers1

0

First, go check this post to see how to split a string into a vector<string>.

Once you did that, and after you checked vector has more than 1 element, you can do vector.erase( vector.begin() ) to remove first element and later vector.pop_back() to remove last element.

Community
  • 1
  • 1
jpo38
  • 20,821
  • 10
  • 70
  • 151