/* What can a file descriptor describe? * A file * A pipe * A piece of information from the kernel that looks like a file but isn't * A network socket (we'll leave that for 435) * A hardware device * A thing that looks like a hardware device but is actually done in software */ #include #include #include int main(){ int fd = open("/dev/random", O_RDONLY); if(fd == -1){ perror(""); return 1; } float random_number; read(fd, &random_number, sizeof(float)); printf("Our random number is: %f\n", random_number); close(fd); return 0; }