1 #include <stdio.h> 2 #include <unistd.h> 3 #include <sys/types.h> 4 #include <sys/stat.h> 5 #include <fcntl.h> 6 #include <stdlib.h> 7 8 #define BUF_SIZE 256 9 int main(void) 10 { 11 int fd = open("/dev/urandom", O_RDONLY); 12 int i; 13 char buf[BUF_SIZE]; 14 15 if (fd < 0) 16 return 1; 17 for (i = 0; i < 4; ++i) 18 read(fd, buf, BUF_SIZE); 19 20 close(fd); 21 return 0; 22 } 23