Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdint.h>
- #define SIZE 3
- int main(void) {
- FILE *fp = fopen("/dev/urandom", "rb");
- if (fp == NULL) {
- perror("fopen");
- exit(EXIT_FAILURE);
- }
- static uint64_t buff[SIZE];
- size_t bytes = fread(buff, sizeof(*buff), SIZE, fp);
- if (bytes != SIZE) {
- fprintf(stderr, "Error reading from /dev/urandom\n");
- exit(EXIT_FAILURE);
- }
- for (size_t i = 0; i < bytes; i++) {
- printf("%llu ", buff[i]);
- }
- putchar('\n');
- if (fclose(fp) == EOF) {
- perror("fclose");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment