adwsystems:
Do you really want to have to remember and/or type all the extra stuff? I do not.
Yes, I do; obviously I would say that because it was me who suggested it in the first place ![]()
And you actually also do as shown in the below quote
adwsystems:
In this particular specific case, the date is supplied to prepare to set an RTC. A separate subsequent dataset would contain a command like "set\n", "exec\n", etc. to actually configure the RTC.
adwsystems:
I'm not sure the question is that hard. Allow me to rephrase. How do to detect the input char[] being passed to atoi() or atof() contains garbage and will not return a valid result? (ie., differentiate between valid 0 return because the data is 0 and a error 0 returned).
For determining if 0 is the result of a conversion error or a valid result, you can look at the more extensive counterparts strtol / strtoul and strtod / strtof. They will happily tell you that something is not a valid (long)(unsigned) integer or not a valid double or float by means of a pointer that is NULL (success) or pointing to the first non-valid character.