Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- srand(time(NULL)*getpid());
- int s = (10 + rand()%101)*1024;
- char name[sizeof(getpid()) + 4];
- sprintf(name, "%d", getpid());
- name[4] = '.';
- name[5] = 't';
- name[6] = 'x';
- name[7] = 't';
- char* buf = malloc(1);
- if(!buf)
- ERR("malloc");
- buf[0] = n + '0';
- if((out = TEMP_FAILURE_RETRY(open(name, O_WRONLY|O_CREAT|O_TRUNC|O_APPEND, 0777))) < 0)
- ERR("open");
- for(int i=0; i<1; i++)
- {
- for(int i=0; i<s; i++)
- if((c = bulk_write(out, buf, 4)) < 0)
- ERR("write");
- TEMP_FAILURE_RETRY(fprintf(stderr, "Block of %d bytes transfered.\n", s*4));
- }
- if(TEMP_FAILURE_RETRY(close(out)))
- ERR("close");
- free(buf);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement