This code reads data from a card.raw file and recovers .JPEG files. I ran this program in the terminal on the Visual Studio codespace, and it worked correctly; the files were recovered and saved. However, when I compile it into an .exe file using JetBrains (CLion) and try to run it on my PC with the same card.raw file, it only generates a file called 000.JPG with 0 KB. I researched, but I haven't understood the reason yet.

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

const int BLOCK_SIZE = 512;
typedef uint8_t BYTE;

int main(int argc, char *argv[])
{
    argv[0] = "aaaa";
    argv[1] = "card.raw";
    argc = 2;

    if (argc != 2)
    {
        printf("Usage: ./recover file.raw\n");
        return 1;
    }

    FILE *image = fopen(argv[1], "r");
    if (image == NULL)
    {
        printf("File not found\n");
        return 1;
    }

    int counter = 0;
    bool isfirst = true;
    BYTE buffer[BLOCK_SIZE];
    char jpegname[8] = "000.jpg";
    FILE *recover = fopen(jpegname, "w");

    while (fread(buffer, 1, BLOCK_SIZE, image) == BLOCK_SIZE)
    {
        if (buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff && (buffer[3] & 0xf0) == 0xe0)
        {
            if (isfirst == true)
            {
                fwrite(buffer, 1, BLOCK_SIZE, recover);
                isfirst = false;
                counter++;
            }
            else
            {
                fclose(recover);
                sprintf(jpegname, "%03i.jpg", counter);
                recover = fopen(jpegname,  Give two different versions of responses. Please separate the responses with 6 asterisk symbols: ******.
user