This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

scanf/printf argument restriction 15 bytes/40 bytes: checking?

This follows up on msg: sprintf arg restriction of 2/6/04

Per the manual, "the total number of bytes passed to scanf() is limited..."

I want to check this. Is this equivalent to the total number of characters entered on a line being interpreted?

My (C166 large model) call is expecting up to 8 arguments, from 2 - 6 chars each, plus commas and spaces. Must I therefore guarantee that the total number of characters does not exceed 40?

CmdCnt = sscanf(serInputBuf, "pnti,%c%f,%c%f,%c%f,%c%f,%c%f,%c%f,%c%f,%c%f",
&Cmd[0], &CmdParm[0], &Cmd[1], &CmdParm[1], &Cmd[2], &CmdParm[2], &Cmd[3], &CmdParm[3], &Cmd[4], &CmdParm[4], &Cmd[5], &CmdParm[5], &Cmd[6], &CmdParm[6], &Cmd[7],             &CmdParm[7]);

a sample input string looks like:
$PNTI, P1, V2, A1.000, ...

0