C251: EXTENDED SCANF ARGUMENT DATA SPACE
Information in this article applies to:
I 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, &values, &values, &values, &values, &values, &values, &values, &values, &values, &values, &values, &values, &values, &values, &values);
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?
A 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:
Last Reviewed: Wednesday, August 3, 2005
of your data.