| | |
Cygwin file generator
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2006
Posts: 9
Reputation:
Solved Threads: 0
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: .
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.
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.
I don't accept change; I don't deserve to live.
C Syntax (Toggle Plain Text)
#include <stdio.h> #include <stdlib.h> #include <time.h> int main (int argc, char *argv[]) { /* Simple "srand()" seed: just use "time()" */ unsigned int iseed = (unsigned int)time(NULL); srand (iseed); /* Now generate 5 pseudo-random numbers */ int i; for (i=0; i<5; i++) { printf ("rand[%d]= %u\n", i, rand ()); } return 0;
Also Maybe the foll:
random number generate and outpt to file
Random number detailed theory
I don't accept change; I don't deserve to live.
•
•
Join Date: Oct 2006
Posts: 9
Reputation:
Solved Threads: 0
~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..
Last edited by muhaa; Oct 19th, 2006 at 7:17 am.
Create multiple file streams, and what you are doign to one file, make that applicable to multiple files.. simple.
C Syntax (Toggle Plain Text)
FILE *output1; FILE* output2; FILE* output3; // ...... // do something with these files // close the above files
Last edited by ~s.o.s~; Oct 19th, 2006 at 12:38 pm.
I don't accept change; I don't deserve to live.
•
•
Join Date: Oct 2006
Posts: 9
Reputation:
Solved Threads: 0
Ok thnx man this is what i have got so far using your examples to help
C Syntax (Toggle Plain Text)
#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; }
Last edited by Salem; Oct 19th, 2006 at 2:05 pm. Reason: Changed inlinecode to code for multi-line code
![]() |
Similar Threads
- C++ File Generator (C++)
- Header file Generator (C)
Other Threads in the C Forum
- Previous Thread: reversing long integers,, newbie,, pls. help
- Next Thread: List of open files
| Thread Tools | Search this Thread |
#include * ansi append array arrays asterisks bash binarysearch centimeter changingto char character convert copyimagefile cprogramme creafecopyofanytypeoffileinc database dynamic execv feet fgets file floatingpointvalidation fork framework function getlogicaldrivestrin givemetehcodez grade gtkwinlinux hacking histogram ide inches include incrementoperators infiniteloop initialization input interest intmain() iso kernel keyboard kilometer license linked linkedlist linux list lists locate looping lowest matrix meter microsoft number oddnumber opendocumentformat openwebfoundation overwrite owf pdf pointer posix power probleminc process program programming radix recursion recv recvblocked research reversing segmentationfault sequential single socket socketprograming socketprogramming standard strchr string suggestions systemcall test testing threads turboc unix urboc user variable wab whythiscodecausesegmentationfault windowsapi






