标签:style strcat code group run tput 结果 cat ret
char* nickname;
nickname=(char*)GetRandChar("Mname",2);
lr_save_string(nickname,"nickname");
lr_output_message(lr_eval_string("nickname")
char* GetRandChar(char* headStr,int num) { int name_num,rand_num,j; char StrTable[]="abcdefghijklmnopqrstuvwsyz"; char i_name[20]=""; name_num=num; //将两个char类型连接,结果放在i_name中 strcat(i_name,headStr); for (j=1;j<=name_num;j++) { rand_num=rand()% 10;//取0-10的随机数,其实这里可以改为and_num=rand()% 24,0—24的随机数
//从StrTable的第rand_num+1个字符开始往后的num个字符添加到i_name的结尾处 strncat(i_name,StrTable+rand_num,num); } strcat(i_name,lr_eval_string("{group}")); strcat(i_name,lr_eval_string("{vuser}")); strncat(i_name,lr_eval_string("{time}")+2, 4); strncat(i_name,lr_eval_string("{time}")+7, 3); strcat(i_name,"\0"); return i_name; }
标签:style strcat code group run tput 结果 cat ret
原文地址:http://www.cnblogs.com/mcsmiaoblog/p/7587553.html