Suppose we have the following situation:
struct Person {
unsigned int id;
std::st
What can I do to read in the separate words forming the name into the one
actRecord.name
variable?
The general answer is: No, you can't do this without additional delimiter specifications and exceptional parsing for the parts forming the intended actRecord.name
contents.
This is because a std::string
field will be parsed just up to the next occurence of a whitespace character.
It's noteworthy that some standard formats (like e.g. .csv
) may require to support distinguishing blanks (' '
) from tab ('\t'
) or other characters, to delimit certain record fields (which may not be visible at a first glance).
Also note:
To read an uint8_t
value as numeric input, you'll have to deviate using a temporary unsigned int
value. Reading just a unsigned char
(aka uint8_t
) will screw up the stream parsing state.