From: Chris Date: Mon, 9 Feb 2015 15:09:42 +0000 (+0100) Subject: Opgave exercise1d.c X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=27647bec462d42fe6e0144cc7356ae6ced748edf;p=sws1-1415.git Opgave 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; +}