The trouble I see with a sscanf-based approach is exception handling when a serial transmission error occurs. To me, using a token scanning / manual parsing approach provides you with more flexibility for doing that.
Indeed, you really need to verify that the sentence was received intact, in the expected format, before attempting to use scanf.
I also find token scanning and parsing to be much more robust. Assuming that numeric fields have fixed width is particularly problematic, unless you have access to the complete specification for the transmission format.
Yes I agree - I was just providing an input with sscanf
There is a checksum that can be used to verify the sentence integrity.
You know how many tokens got parsed according to the format but that’s about it. It’s not super detailed
Oh My.... I've never had so much attention!
Thank you everybody, I now have 2 different approaches to the task. I was determined to make the sscanf thing work. I am an enthusiastic amateur and in the past I would have used indexOf() and substrings. Learning every day.
cheers
John
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.