Hi guy's i was wondering if any one can help i wat to make a random file generator which will be able to create random file's with random string's in them also i wilkl have to be able to control the file extension..Its for a file fuzzer im working on any help would be much apriciated also would like to use cygwin..Random string's like

AAAAAAAAAAAAABBBBBBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDEEEEE//////\\\\----===\\\\|=
CCCCCCCDDDDEEEEEEEEWWWWWWAAAAAAAAAAAA[[[[[]]]]

so the aboved is just an example i want to fill the file with any thing realy i want to let the program decide but i also will ne to control the amount of byte's that is wrote to the file basicaly every thing will be random so it will print 40 file's of a file extension i chose and write diffrent string's to the file any help would be grate:eek: .

Any leads you have got so far, post your code or your algorithm and we will help you out. Posting out what you want to do is no good to us in helping you.

PS: If you want to write random data, use the normal random function which will generate random numbers between 1 and 128. Cast those numbers to "char" data type and write them to your file. This way you will get random chars in your data file.

Hi thnx for the rely i am just starting to code the application any chance you got any link's that might give me a good start thnx in advance.

~s.o.s~ what can i say man you are great very much apriciated m8..I know alot of language's a bit of c c++ but i know more of perl python ruby any way's if i have any further question i will post cant thank you enough m8..Just got to find out haw i can restrict the file size also and write to multiple file's instead of just the one..

..write to multiple file's instead of just the one..

Create multiple file streams, and what you are doign to one file, make that applicable to multiple files.. simple.

FILE *output1; 
FILE* output2;
FILE* output3; // ......
 
// do something with these files
 
// close the above files

Ok thnx man this is what i have got so far using your examples to help

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int rrand(int min,int max)
{
  static int init = 0;
  int ret;

  if(init==0){
    srand(time(NULL));
    init=1;
  }
  ret = (rand() % (max-min+1) + min);
  return ret;
}

int main(void)
{
  int i, r;
  for(i=0;i<20;i++){
    r = rrand(65,90);   /* 65 = A, 90 = Z. get it? */
    printf("Random char = %c\n",r);
  }
  return 0;
}
This article has been dead for over six months. Start a new discussion instead.