aboutsummaryrefslogtreecommitdiff
path: root/test cases/30 pipeline/srcgen.c
blob: c4e412bef9604c779d5ee74b3c2762f1b16ae2f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<stdio.h>
#include<assert.h>

int main(int argc, char **argv) {
    const int ARRSIZE = 80;
    char arr[ARRSIZE];
    if(argc != 3) {
        fprintf(stderr, "%s <input file> <output file>\n", argv[0]);
        return 1;
    }
    char *ifilename = argv[1];
    char *ofilename = argv[2];
    printf("%s\n", ifilename);
    FILE *ifile = fopen(ifilename, "r");
    if(!ifile) {
        fprintf(stderr, "Could not open source file %s.\n", ifilename);
        return 1;
    }
    FILE *ofile = fopen(ofilename, "w");
    if(!ofile) {
        fprintf(stderr, "Could not open target file %s\n", ofilename);
        return 1;
    }
    size_t bytes;
    bytes = fread(arr, 1, ARRSIZE, ifile);
    assert(bytes < 80);
    assert(bytes > 0);
    fwrite(arr, 1, bytes, ofile);

    fclose(ifile);
    fclose(ofile);
    return 0;
}