I have a file of this type:
key1#value1#value2##
key2#value3#value4#value5##
key3#value6##
etc.
I need to read each line, and separate key and values. I've tried different approaches (istringstream & iterator
- but I don't know how to explicitly define # as the separator), double getline
, I read about boost
libraries but I am not sure I would be able to compile it.
I thought another way to do it would be to separate each line into a vector. The first element will always be the key, and vector's size will determine how many values each line had.
What is the best way to split each line?