XOR encryption program in C
Use binary mode
Currently, you are opening your files like this:

    in = fopen(optarg, &quot;r&quot;);
    out = fopen(optarg, &quot;w&quot;);


On a UNIX system that would be fine, but on a Windows system, that could result in CRLF pairs being converted into a single LF when reading, and single LF characters converted to CRLF pairs when writing.  This is particularly important because once you do the xor operation, your output may contain random LF characters.
You should open your files in binary mode instead:
    in = fopen(optarg, &quot;rb&quot;);
    out = fopen(optarg, &quot;wb&quot;);