| 1 | /* |
| 2 | fopen test */ |
| 3 | #include <stdio.h> |
| 4 | #include <stdlib.h> |
| 5 | |
| 6 | void writeandclose(FILE *a) { |
| 7 | fprintf(a, "abc\n"); |
| 8 | fclose(a); |
| 9 | } |
| 10 | |
| 11 | int main(int argc, char **argv) { |
| 12 | /* test that the three args work. */ |
| 13 | if (argc < 4) { |
| 14 | exit(1); |
| 15 | } |
| 16 | |
| 17 | writeandclose(fopen(argv[1], "r")); |
| 18 | writeandclose(fopen(argv[2], "w")); |
| 19 | writeandclose(fopen(argv[3], "a")); |
| 20 | return 0; |
| 21 | } |