From: Mart Lubbers Date: Sun, 8 Feb 2015 17:33:11 +0000 (+0100) Subject: update ass1-ex1 X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=9a8c60cc0392f0785d387af3670344df08f2a37c;p=sws1-1415.git update ass1-ex1 --- diff --git a/ass2/mart/sws1-s4109503-s4202015/Makefile b/ass2/mart/sws1-s4109503-s4202015/Makefile index cacd2e7..1b465c7 100644 --- a/ass2/mart/sws1-s4109503-s4202015/Makefile +++ b/ass2/mart/sws1-s4109503-s4202015/Makefile @@ -1,7 +1,9 @@ CC=gcc CFLAGS=-std=c99 -Wall -Wextra -all: exercise1b.c exercise1d.c +all: exercise1 + +exercise1: exercise1b.c exercise1d.c $(CC) $(CFLAGS) exercise1b.c -o exercise1b $(CC) $(CFLAGS) exercise1d.c -o exercise1d diff --git a/ass2/mart/sws1-s4109503-s4202015/exercise1b.c b/ass2/mart/sws1-s4109503-s4202015/exercise1b.c index 9cbaa94..1f8a43e 100644 --- a/ass2/mart/sws1-s4109503-s4202015/exercise1b.c +++ b/ass2/mart/sws1-s4109503-s4202015/exercise1b.c @@ -1,7 +1,7 @@ #include #include -int main() +int main(void) { FILE *f = fopen("/dev/urandom", "r"); char c; @@ -9,7 +9,6 @@ int main() c = fgetc(f); printf("%i %u %x\n", c, c, c); } while(c != 42); - if(f != stdin) - fclose(f); + fclose(f); return 0; } diff --git a/ass2/mart/sws1-s4109503-s4202015/exercise1d.c b/ass2/mart/sws1-s4109503-s4202015/exercise1d.c index 4b6e9c7..07dfa41 100644 --- a/ass2/mart/sws1-s4109503-s4202015/exercise1d.c +++ b/ass2/mart/sws1-s4109503-s4202015/exercise1d.c @@ -2,7 +2,7 @@ #include #include -int main() +int main(void) { FILE *f = fopen("/dev/urandom", "r"); uint16_t c; @@ -10,7 +10,6 @@ int main() c = fgetc(f)+fgetc(f)*256; printf("%04x\n", c); } while(c != 42); - if(f != stdin) - fclose(f); + fclose(f); return 0; } diff --git a/ass2/mart/sws1-s4109503-s4202015/exercise2.c b/ass2/mart/sws1-s4109503-s4202015/exercise2.c new file mode 100644 index 0000000..6ea6252 --- /dev/null +++ b/ass2/mart/sws1-s4109503-s4202015/exercise2.c @@ -0,0 +1,4 @@ +int main(void) +{ + +}