summaryrefslogtreecommitdiffstats
path: root/test cases/native/3 pipeline/src/srcgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/native/3 pipeline/src/srcgen.c')
-rw-r--r--test cases/native/3 pipeline/src/srcgen.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/test cases/native/3 pipeline/src/srcgen.c b/test cases/native/3 pipeline/src/srcgen.c
new file mode 100644
index 0000000..26761d2
--- /dev/null
+++ b/test cases/native/3 pipeline/src/srcgen.c
@@ -0,0 +1,40 @@
+#include<stdio.h>
+#include<assert.h>
+
+#define ARRSIZE 80
+
+int main(int argc, char **argv) {
+ char arr[ARRSIZE];
+ char *ifilename;
+ char *ofilename;
+ FILE *ifile;
+ FILE *ofile;
+ size_t bytes;
+
+ if(argc != 3) {
+ fprintf(stderr, "%s <input file> <output file>\n", argv[0]);
+ return 1;
+ }
+ ifilename = argv[1];
+ ofilename = argv[2];
+ printf("%s\n", ifilename);
+ ifile = fopen(ifilename, "r");
+ if(!ifile) {
+ fprintf(stderr, "Could not open source file %s.\n", ifilename);
+ return 1;
+ }
+ ofile = fopen(ofilename, "w");
+ if(!ofile) {
+ fprintf(stderr, "Could not open target file %s\n", ofilename);
+ fclose(ifile);
+ return 1;
+ }
+ bytes = fread(arr, 1, ARRSIZE, ifile);
+ assert(bytes < 80);
+ assert(bytes > 0);
+ fwrite(arr, 1, bytes, ofile);
+
+ fclose(ifile);
+ fclose(ofile);
+ return 0;
+}