From 4cd4276ff9c1da6dffd2d7dafc38c81861f7b5e9 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 9 Feb 2015 16:23:04 +0100 Subject: [PATCH] verbetering --- ass2/chris/sws1-s4109503-s4202015/exercise1d.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ass2/chris/sws1-s4109503-s4202015/exercise1d.c b/ass2/chris/sws1-s4109503-s4202015/exercise1d.c index 545dd2a..9a3874d 100644 --- a/ass2/chris/sws1-s4109503-s4202015/exercise1d.c +++ b/ass2/chris/sws1-s4109503-s4202015/exercise1d.c @@ -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); -- 2.20.1