Prototyping Woes
Kevin W. Reed
kreed at telesys.cts.com
Tue Mar 5 13:08:26 AEST 1991
I have a routine that can accept multiple parameters. I'm having a problem
getting the compiler to accept a prototype so that it doesn't complain
that I have "too many actual arguments".
The routine takes a string of characters with fields separated by |'s and
extracts the fields and places them into the arguments that it is called
with.
For example:
buffer = "field1|field2|field3"
would be extracted with:
pickit ( 3, buffer, fld1, fld2, fld3);
and
buffer = "field1|field2|field3|field4"
would be extracted with:
pickit ( 4, buffer, fld1, fld2, fld3, fld4);
The routine works great. But the compiler continues to complain
with warning errors that "too many actual parameters" are being called.
I have tried several variations, all with the same results.
Below is the routine, Any suggestions?
----- pickit routine ------
pickit(int nargs, char *buffer, char *args)
{
char **p;
int i, l;
p = &args;
l=0;
/* First check that they are enough fields for the request */
for ( i = strlen (buffer) ; i > 0 ; i-- )
if ( buffer[ i - 1 ] == '|' )
l++;
if ( l < nargs )
return(ERROR);
/* Now extract the fields */
for ( i = 0 ; i < nargs ; i++ )
{
while ( ( *( *p )++ = *buffer++ ) ! = '|' );
*( *p - 1 ) = '\0';
p++;
}
return(TRUE);
}
----- end of pickit routine ------
Below is the actual error message that I get from the compiler [only one
shown for brevity]
ts2umodify.c(122) : warning C4020: 'pickit' : too many actual parameters
The system I'm using is...
System: Intel 386DX Clone
OS: SCO Xenix 386 2.3.[23]
Dev: SCO Development System 2.3.1b
Thanks for the help
--
Kevin W. Reed --- TeleSys Development Systems -- PO 17821, San Diego, CA 92177
TeleSys-II BBS & telesys.UUCP 619-483-3890 ----- Telebit PEP Line 619 483 0965
UUCP: {nosc,ucsd}!crash!telesys!kreed -------- Internet: kreed at telesys.cts.com
More information about the Comp.lang.c
mailing list