Opgave exercise1d.c
authorChris <mail@chriskamphuis.com>
Mon, 9 Feb 2015 15:09:42 +0000 (16:09 +0100)
committerChris <mail@chriskamphuis.com>
Mon, 9 Feb 2015 15:09:42 +0000 (16:09 +0100)
ass2/chris/sws1-s4109503-s4202015/exercise1d.c [new file with mode: 0644]

diff --git a/ass2/chris/sws1-s4109503-s4202015/exercise1d.c b/ass2/chris/sws1-s4109503-s4202015/exercise1d.c
new file mode 100644 (file)
index 0000000..545dd2a
--- /dev/null
@@ -0,0 +1,15 @@
+#include<stdio.h>
+#include<stdint.h>
+
+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;
+}