Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <fcntl.h>
- #include <unistd.h>
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
- #include <time.h>
- #define BUFSIZE 1024
- void cipher(char *file)
- {
- char buf[BUFSIZE];
- FILE *f1;
- int nread=-1;
- char ch;
- int i, n,m;
- time_t t;
- srand((unsigned) time(&t));
- f1 = fopen (file, O_RDONLY);
- if(f1<0)
- {
- printf("Error is: %s\n", strerror(errno));
- exit(1);
- }
- while ((ch = fgetc(f1)) != EOF)
- {
- printf("%c", ch);
- n=rand()%9+1;
- printf("%d",n);
- for(i=0;i<n;i++)
- {
- printf("%c",rand()%26+97);
- }
- }
- }
- int main(int argc, char **argv){
- cipher(argv[1]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement