| ||||||||
Technical Support Support Resources Product Information | C251: EXTENDED SCANF ARGUMENT DATA SPACEInformation in this article applies to:
QUESTIONI understand that the total number of bytes of arguments you can pass to a function using a variable-length argument list is limited. The limit is just 40 bytes for the LARGE memory model. That amounts to ten 4-byte arguments. I need to pass more than that to the scanf function. In my application I must convert a very long command string that contains 16 HEX values. The sscanf invocation appears as follows:
args = sscanf(cmd_str, "%*s %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x",
&cdc_cmd,
&values[0], &values[1], &values[2], &values[3],
&values[4], &values[5], &values[6], &values[7],
&values[8], &values[9], &values[10], &values[11],
&values[12], &values[13], &values[14], &values[15]);
When I compile this module I receive the following error message: ERROR C187: 'SSCANF': SIZE OF ACTUALS EXCEEDS 'MAXARGS' How can I overcome this problem? ANSWERA simple solution to your problem is to use the reentrant version of the sscanf function. You may do this by adding the #pragma function statements around the stdio.h include file. For example: #pragma functions (reentrant) #include <stdio.h> /* Standard I/O prototypes */ #pragma functions (static) A problem with this solution is that your application may use a large amount of the hardware stack. To avoid this, you can extend the parameter area of the static scanf function as follows:
MORE INFORMATION
Last Reviewed: Wednesday, August 03, 2005 | |||||||
| ||||||||