From: Mart Lubbers Date: Mon, 9 Feb 2015 15:22:25 +0000 (+0100) Subject: updated ass1-1 X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=4df51d3f86094ecc4469d408b771e47899ccfda3;p=sws1-1415.git updated ass1-1 --- diff --git a/ass2/mart/sws1-s4109503-s4202015/exercise1b.c b/ass2/mart/sws1-s4109503-s4202015/exercise1b.c index c9473bd..53f11af 100644 --- a/ass2/mart/sws1-s4109503-s4202015/exercise1b.c +++ b/ass2/mart/sws1-s4109503-s4202015/exercise1b.c @@ -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); diff --git a/ass2/mart/sws1-s4109503-s4202015/exercise1d.c b/ass2/mart/sws1-s4109503-s4202015/exercise1d.c index 7555bc9..cca7449 100644 --- a/ass2/mart/sws1-s4109503-s4202015/exercise1d.c +++ b/ass2/mart/sws1-s4109503-s4202015/exercise1d.c @@ -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); diff --git a/ass2/mart/sws1-s4109503-s4202015/exercise1d.txt b/ass2/mart/sws1-s4109503-s4202015/exercise1d.txt index 651c337..191111d 100644 --- a/ass2/mart/sws1-s4109503-s4202015/exercise1d.txt +++ b/ass2/mart/sws1-s4109503-s4202015/exercise1d.txt @@ -1,10 +1,10 @@ -271325 -40516 -65532 -23964 -41888 -95550 -234585 -50847 -85879 -87536 +6761 +74577 +128457 +60502 +10085 +166838 +3048 +132493 +22648 +28535