splitchartoparamarr(char *x,char *y,char *paramarrname)//该函数的作用是将输入的字符串x,通过y符号分割,保存到paramarrname参数数组中
{
extern char * strtok(char * string, const char * delimiters );
char charstring[1000],separators[100],paramname[110];//定义输入字符串,字符串长度为1000,分隔符长度为100,参数元素名长度110
char * token;
int i=0;//初始化计数器
char paramcount[10],paramarrcount[110];//定义生成参数数组的编号及参数名
strcpy(charstring,x);
strcpy(separators,y);
token = (char *)strtok(charstring, separators);// Get the first token
if (!token) {
lr_output_message ("No tokens found in string!");
return( -1 );
}
while (token != NULL )// While valid tokens are returned
{
// lr_output_message ("%s", token );//输入分割值
i++;
sprintf(paramname,"%s_%d",paramarrname,i);
// lr_output_message ("%s", paramname );//输出参数名
lr_save_string(token,paramname);
token = (char *)strtok(NULL, separators); // Get the next token
}
sprintf(paramarrcount,"%s_count",paramarrname);
itoa(i,paramcount,10);
lr_save_string(paramcount,paramarrcount);
}
{
extern char * strtok(char * string, const char * delimiters );
char charstring[1000],separators[100],paramname[110];//定义输入字符串,字符串长度为1000,分隔符长度为100,参数元素名长度110
char * token;
int i=0;//初始化计数器
char paramcount[10],paramarrcount[110];//定义生成参数数组的编号及参数名
strcpy(charstring,x);
strcpy(separators,y);
token = (char *)strtok(charstring, separators);// Get the first token
if (!token) {
lr_output_message ("No tokens found in string!");
return( -1 );
}
while (token != NULL )// While valid tokens are returned
{
// lr_output_message ("%s", token );//输入分割值
i++;
sprintf(paramname,"%s_%d",paramarrname,i);
// lr_output_message ("%s", paramname );//输出参数名
lr_save_string(token,paramname);
token = (char *)strtok(NULL, separators); // Get the next token
}
sprintf(paramarrcount,"%s_count",paramarrname);
itoa(i,paramcount,10);
lr_save_string(paramcount,paramarrcount);
}