I have a one-argument constructor, for a base class, that takes a std::istream& in as a parameter. in is suppose to be a file with fields seperated by comma:
c, Toyota , n, 157
r, Jaguar , u, 246, 0.2
c, Honda , b, 145
Each field is suppose to be extracted from each line and placed in their own variable, except for the last field of line leading with r, which is suppose to stay in std::istream& in to be used in the derived class constructor.
I want to know if there is a way that I can: 1. Count the number of comma/delimiters in a line 2. Go back to the start of that same line and extract the correct fields from the line 4. Leave the "values" of the last field of lines leading with r, in the std::istream&
Aucun commentaire:
Enregistrer un commentaire