From 27647bec462d42fe6e0144cc7356ae6ced748edf Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 9 Feb 2015 16:09:42 +0100 Subject: [PATCH] Opgave exercise1d.c --- ass2/chris/sws1-s4109503-s4202015/exercise1d.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ass2/chris/sws1-s4109503-s4202015/exercise1d.c diff --git a/ass2/chris/sws1-s4109503-s4202015/exercise1d.c b/ass2/chris/sws1-s4109503-s4202015/exercise1d.c new file mode 100644 index 0000000..545dd2a --- /dev/null +++ b/ass2/chris/sws1-s4109503-s4202015/exercise1d.c @@ -0,0 +1,15 @@ +#include +#include + +int main(){ + FILE *fp = fopen("/dev/urandom","r"); + unsigned char buffer[2]; + uint16_t read = 0; + do{ + fread(buffer, 2, 1, fp); + read = 256*buffer[0] + buffer[1]; + printf("%x \n", read); + }while(read != 42); + fclose(fp); + return 0; +} -- 2.20.1