equal
deleted
inserted
replaced
1 /** |
1 /** |
2 * test/demos/tree.c |
2 * test/demos/urandom.c |
3 * Copyright (C) 2008 Markus Broeker |
3 * Copyright (C) 2008 Markus Broeker |
4 */ |
4 */ |
5 |
5 |
6 #include <stdio.h> |
6 #include <stdio.h> |
7 #include <stdlib.h> |
7 #include <stdlib.h> |
26 if (fd == -1) |
26 if (fd == -1) |
27 return EXIT_FAILURE; |
27 return EXIT_FAILURE; |
28 |
28 |
29 elements = read (fd, numbers, 255); |
29 elements = read (fd, numbers, 255); |
30 numbers[elements] = 0; |
30 numbers[elements] = 0; |
|
31 close (fd); |
31 |
32 |
32 qsort (numbers, elements, sizeof (unsigned char), (void *)&compare); |
33 qsort (numbers, elements, sizeof (unsigned char), (void *)&compare); |
33 |
34 |
34 for (i = 0; i < elements; i++) { |
35 for (i = 0; i < elements; i++) { |
35 printf ("Number: %d\n", numbers[i]); |
36 printf ("Number: %d\n", numbers[i]); |
36 } |
37 } |
37 |
38 |
38 close (fd); |
|
39 |
|
40 return EXIT_SUCCESS; |
39 return EXIT_SUCCESS; |
41 } |
40 } |