Skip to content
Snippets Groups Projects
Commit fb5b49c0 authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Praktikum 11.1.2016: Beispielprogramme

parent 08ffc0c4
Branches
No related tags found
No related merge requests found
#include <stdio.h>
#include <stdlib.h>
__attribute__ ((noreturn)) void fatal_error (char *msg)
{
fprintf (stderr, "%s\n", msg);
exit (1);
}
int main (void)
{
fatal_error ("error not found");
}
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main (int argc, char **argv)
{
FILE *dev_random = fopen ("/dev/random", "rb");
if (!dev_random)
{
fprintf (stderr, "%s: cannot open /dev/random\n", argv[0]);
exit (1);
}
else
{
uint16_t x;
fread (&x, sizeof (x), 1, dev_random);
printf ("%d\n", x);
fclose (dev_random);
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment