26 lines
523 B
C++
Raw Normal View History

#include <stdio.h>
#include <stdlib.h>
2016-07-09 11:21:54 +02:00
int main(int argc, char* argv[])
{
2016-07-09 11:21:54 +02:00
if (argc < 2) {
fprintf(stderr, "Missing name of file to create.\n");
return EXIT_FAILURE;
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
2016-07-09 11:21:54 +02:00
FILE* stream = fopen(argv[1], "w");
if (stream == NULL) {
fprintf(stderr, "Unable to open %s for writing!\n", argv[1]);
return EXIT_FAILURE;
2016-07-09 11:21:54 +02:00
}
2016-07-09 11:21:54 +02:00
if (fclose(stream)) {
fprintf(stderr, "Unable to close %s!\n", argv[1]);
return EXIT_FAILURE;
2016-07-09 11:21:54 +02:00
}
fprintf(stdout, ">> Creating %s!\n", argv[1]);
2013-03-16 19:13:01 +02:00
return EXIT_SUCCESS;
}