...
Code Block | ||
---|---|---|
| ||
int i;
ssize_t count = 0;
for (i = 0; i < 9; ++i)
count +=
sprintf(buf + count, "%02x ", ((u8 *)&slreg_num)[i]);
count += sprintf(buf + count, "\n");
|
...
Code Block | ||
---|---|---|
| ||
errno_t sprintf_m( string_m buf, const string_m fmt, int *count, ... ); |
The sprintf_m()
API separates out the return status of the function from information about the number of characters written. In this case, *count
is set to the number of characters written in buf
, while the return value indicates the return status. Returning the status as the return value of the function increases the likelihood that a programmer will check the return status of the function.
...