Zee的LR脚本练习一:写随机数到文本里

 

typedef long time_t;
Action()
{

 int i,k;
time_t t;
char *filename="c://test.txt";
 long file;
 srand((unsigned) time(&t));
 lr_output_message("Ten random numbers from 0 to 99/n/n");

if ((file = fopen(filename, "w+" )) == NULL) {

   lr_output_message("Unable to create %s", filename);

   return -1;
 }

 for (i=0; i<10; i++)     {
  lr_output_message("%d/n", rand()%100);
 k= rand()%100;
   fprintf(file,"%d /n ",k);
 }

   fclose(file);
return 0;


你可能感兴趣的:(脚本,File,Random,action,output,Numbers)