verbetering
authorChris <mail@chriskamphuis.com>
Mon, 9 Feb 2015 15:23:04 +0000 (16:23 +0100)
committerChris <mail@chriskamphuis.com>
Mon, 9 Feb 2015 15:23:04 +0000 (16:23 +0100)
ass2/chris/sws1-s4109503-s4202015/exercise1d.c

index 545dd2a..9a3874d 100644 (file)
@@ -3,11 +3,9 @@
 
 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];
+               fread(&read, 2, 1, fp);
                printf("%x \n", read);
        }while(read != 42);
        fclose(fp);