Debian Codegraph @

Tests/ComplexOneConfig/Library/create_file.cxx

raw
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 int main(int argc, char* argv[])
5 {
6 if (argc < 2) {
7 fprintf(stderr, "Missing name of file to create.\n");
8 return EXIT_FAILURE;
9 }
10
11 FILE* stream = fopen(argv[1], "w");
12 if (stream == NULL) {
13 fprintf(stderr, "Unable to open %s for writing!\n", argv[1]);
14 return EXIT_FAILURE;
15 }
16
17 if (fclose(stream)) {
18 fprintf(stderr, "Unable to close %s!\n", argv[1]);
19 return EXIT_FAILURE;
20 }
21
22 fprintf(stdout, ">> Creating %s!\n", argv[1]);
23
24 return EXIT_SUCCESS;
25 }