repositories
/
sws1-1415.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
448e09c
)
verbetering
author
Chris
<mail@chriskamphuis.com>
Mon, 9 Feb 2015 15:23:04 +0000
(16:23 +0100)
committer
Chris
<mail@chriskamphuis.com>
Mon, 9 Feb 2015 15:23:04 +0000
(16:23 +0100)
ass2/chris/sws1-s4109503-s4202015/exercise1d.c
patch
|
blob
|
history
diff --git
a/ass2/chris/sws1-s4109503-s4202015/exercise1d.c
b/ass2/chris/sws1-s4109503-s4202015/exercise1d.c
index
545dd2a
..
9a3874d
100644
(file)
--- 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);