|
2#
楼主 |
发表于 2007-11-22 10:45:25
|
只看该作者
有这样一个函数,模拟一段随机生成的字符串,如何用上去呢?
int itera_num,rand_num,i;
char StrTable[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
char i_name[24]="";
char i_data[50]="";
char i_data2[24]="";
itera_num=rand()%24;
for (i=0;i<=itera_num;i++){
rand_num=rand()%62;
strncat(i_name,StrTable+rand_num,1);}
itera_num=rand()%50;
for(i=0;i<=itera_num;i++){
rand_num=rand()%62;
strncat(i_data,StrTable+rand_num,1);}
i=rand()%strlen(i_data)+1;
strncat(i_data2,i_data,i);
lr_save_string(i_name,"i_name_value");
lr_save_string(i_data,"i_data_value");
lr_save_string(i_data2,"i_data2_value"); |
|