I'm trying to make a program that concatenates multiple files to one. The code that i currently have is the following:
#include <string.h>
#include <stdio.h>
void main(int n, char** args) {
    if (n < 2) printf("Too few arguments. Format: <output> [files...]");
    FILE* output = fopen(args[1], "w");
    for (int i = 2; i < n; i++) {
        FILE* curr = fopen(args[i], "rb");
        while (!feof(curr)) {
            int c = fgetc(curr);
            fputc(c, output);
        }
        fclose(curr);
    }
    fclose(output);
}
But, when I have \n in a file, fgetc adds \r behind the \n in the new file. I've tried to open the file as binary, but it still adds the additional \r behind all \n-s.
How do I get rid of this functionality?
 
    