|
As follows: a variable parameter function,
variable is the number of parameters of the variable parameters that I know in advance (taken from the database)
void add_Log_Msg (int log_msg_macro, int uid, char * sn, ...)
{
va_start (vp, sn);
variable = spLogsMsg-> variableNum;
if (variable> 0)
{
for (i = 0; i <variable; i ++)
{
s_varible_value [i] = va_arg (vp, char *);
}
}
va_end (vp);
...
}
I decided to take a few variable parameters according to the variable.
Because the program does not know it will still fetch it, but this parameter does not exist, causing the program to crash.
How to solve this problem? |
|