| 1 | #include <stdio.h> |
|---|---|
| 2 | #include <string.h> |
| 3 | #include <stdlib.h> |
| 4 | |
| 5 | /* This program writes its arguments (separated by '\0') to stdout. */ |
| 6 | int |
| 7 | main(int argc, char const *argv[]) |
| 8 | { |
| 9 | int i; |
| 10 | |
| 11 | FILE *output = fopen (filename: argv[1], modes: "w"); |
| 12 | if (output == NULL) |
| 13 | exit (status: 1); |
| 14 | |
| 15 | for (i = 2; i < argc; ++i) |
| 16 | fwrite(ptr: argv[i], size: strlen(s: argv[i])+1, n: 1, s: output); |
| 17 | |
| 18 | fclose (stream: output); |
| 19 | |
| 20 | return 0; |
| 21 | } |
| 22 |
