2008-10-12 18:41:06 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2016-07-09 11:21:54 +02:00
|
|
|
int main(int argc, char* argv[])
|
2008-10-12 18:41:06 +02:00
|
|
|
{
|
2016-07-09 11:21:54 +02:00
|
|
|
if (argc < 2) {
|
2008-10-12 18:41:06 +02:00
|
|
|
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) {
|
2008-10-12 18:41:06 +02:00
|
|
|
fprintf(stderr, "Unable to open %s for writing!\n", argv[1]);
|
|
|
|
return EXIT_FAILURE;
|
2016-07-09 11:21:54 +02:00
|
|
|
}
|
2008-10-12 18:41:06 +02:00
|
|
|
|
2016-07-09 11:21:54 +02:00
|
|
|
if (fclose(stream)) {
|
2008-10-12 18:41:06 +02:00
|
|
|
fprintf(stderr, "Unable to close %s!\n", argv[1]);
|
|
|
|
return EXIT_FAILURE;
|
2016-07-09 11:21:54 +02:00
|
|
|
}
|
2008-10-12 18:41:06 +02:00
|
|
|
|
|
|
|
fprintf(stdout, ">> Creating %s!\n", argv[1]);
|
2013-03-16 19:13:01 +02:00
|
|
|
|
2008-10-12 18:41:06 +02:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|