|
今天心情好专门写了个randomchar的函数给你,记得留版权哦。。。
//create by cloudchen 2010.8.12 in beijing
//randomchar 调用该函数输入一个int型字符串长度和一个参数名,会自动生成由a-z,A-Z,0-9的随机字符串并用该参数名返回
void RandomChar(int mystrlen,char *paramname)
{
char tmp[100];
int i;
strcpy(tmp,"Cloud");//这里自己可以定义需要生成字符串的开头
for (i = 0; i<mystrlen; i++)
{
lr_save_var("abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"+(rand()%61+1),1,0,"temp");
strcat(tmp,lr_eval_string("{temp}"));
//lr_output_message(tmp);
}
lr_save_string(tmp,paramname);
}
Action()
{
RandomChar(12,"mystr");
lr_output_message("this is my needs random string=%s",lr_eval_string("{mystr}"));
return 0;
} |
|