updated ass1-1
authorMart Lubbers <mart@martlubbers.net>
Mon, 9 Feb 2015 15:22:25 +0000 (16:22 +0100)
committerMart Lubbers <mart@martlubbers.net>
Mon, 9 Feb 2015 15:22:25 +0000 (16:22 +0100)
ass2/mart/sws1-s4109503-s4202015/exercise1b.c
ass2/mart/sws1-s4109503-s4202015/exercise1d.c
ass2/mart/sws1-s4109503-s4202015/exercise1d.txt

index c9473bd..53f11af 100644 (file)
@@ -3,7 +3,7 @@
 int main(void)
 {
        FILE *f = fopen("/dev/urandom", "r");
-       unsigned char c;
+       char c;
        do {
                c = fgetc(f);
                printf("%i %u %x\n", c, c, c);
index 7555bc9..cca7449 100644 (file)
@@ -4,9 +4,9 @@
 int main(void)
 {
        FILE *f = fopen("/dev/urandom", "r");
-       uint16_t c;
+       uint16_t c = 0;
        do {
-               c = fscanf(f, SCNu16);
+               fread(&c, 2, 1, f);
                printf("%04x\n", c);
        } while(c != 42);
        fclose(f);
index 651c337..191111d 100644 (file)
@@ -1,10 +1,10 @@
-271325
-40516
-65532
-23964
-41888
-95550
-234585
-50847
-85879
-87536
+6761
+74577
+128457
+60502
+10085
+166838
+3048
+132493
+22648
+28535