Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <string.h>
- #include <errno.h>
- #include <stdlib.h>
- #include <time.h>
- #include <unistd.h>
- #define BUFFERGROOTTE 20
- int main(){
- int descriptor = open("test.txt", O_WRONLY | O_CREAT | O_APPEND, S_IWUSR);
- if(descriptor < 0){
- printf("Er is een fout gebeurd bij het inlezen");
- } else {
- srand(time(NULL));
- int i = 0;
- for(i; i < 500000; i++){
- char letter = 'a' + rand() % 26;
- char buffer[BUFFERGROOTTE];
- int j = 0;
- for(j; j < 20; j++){
- buffer[j] = letter;
- }
- write(descriptor, buffer,1);
- }
- close(descriptor);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement