From: Chris Date: Mon, 9 Feb 2015 15:23:04 +0000 (+0100) Subject: verbetering X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=4cd4276ff9c1da6dffd2d7dafc38c81861f7b5e9;p=sws1-1415.git verbetering --- 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);