What do you get and what do you expect?
Also, why have you changed your
message
member to a
std::string
array instead of letting it an
uint8_t
array as used in your previous question
Read and store array of hexadecimal data[
^]?
The only problem I can see is that you forgot to read the message length
byte_lent
:
iss >> data.time;
iss >> data.state;
iss >> data.ID;
iss >> data.status;
iss >> data.type;
iss >> data.byte_lent;
for (unsigned int i = 0; i < data.byte_lent; i++)
{
}
[EDIT: Clarifying]
Quote from (not a) solution:
and ignore 8 and length, bitcount and ID
If you want to ignore the length, you still have to read it from the stream. Otherwise, it will be read as first message data.
The remaining data after the message bytes are skipped by just not reading further from the stream buffer but processing the next line.
[/EDIT]