0
int main(int argc, char* argv[])
{
    // declaring buffer array
    int buffer[512];
    int counter = 0; 

    // open file
    FILE* card = fopen("card.raw", "r");
    if (card == NULL)
    {
        printf("Could not open %s.\n", card.raw);
        return 1;
    }

    // find JPEG 
    while (!feof(card))
    {   
        // read card and temporary store infomration in buffer 
        fread (&buffer, sizeof(buffer), 1, card);

        // if 4-byte JPEG sequence is found, do this loop 
        if (buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff && (buffer[3] == 0xe0 || buffer[3] == 0xe1 || buffer[3] == 0xe2 || buffer[3] == 0xe3 || buffer[3] == 0xe4 || buffer[3] == 0xe5 || buffer[3] == 0xe6 || buffer[3] == 0xe7 || buffer[3] == 0xe8 || buffer[3] == 0xe9 || buffer[3] == 0xea || buffer[3] == 0xeb || buffer[3] == 0xec || buffer[3] == 0xed || buffer[3] == 0xee || buffer[3] == 0xef))
        {
            char [] title;

            // if this is the first JPEG sequence  
            if (counter == 0) 
            {
                sprintf (title, "%.3d.jpg", counter);

                // open new file 
                FILE *img = fopen ("%.3d.jpg", "a");
                fwrite (&buffer, sizeof(buffer), 1, title);
                counter++;  
            }

            else 
                sprintf (title, "%.3d.jpg", counter);
                fwrite (&buffer, sizeof(buffer), 1, title);
                counter++; 

        }

        fclose "%.3d.jpg";
    }

    fclose card; 

    return 0;

}
1
  • it seems that you are not in the correct directory
    – MARS
    Sep 15 '16 at 19:57
0

That's a compiler error, not a code error per se.

Make certain that your source code is called recover.c and the source file is in the same current working directory that you are executing the make recover command in.

To verify this, just execute:

ls

to list the files in the current working directory, and

pwd

to print the working directory.

If you are not certain where you have saved the file relative to your working directory, try:

find ~ -name recover.c

This presupposes that you have saved the file with the correct name.

Finally, there is one other possiblity. In the c9 editor tab for recover.c in your IDE, is there an asterisk next to the file name? If so, you have not saved the file at all, which is why it will not compile.

Hope this helps!

2
  • I was in the wrong folder! Thanks Sep 15 '16 at 20:32
  • Cool! Please accept my answer by clicking on the green check mark; otherwise it will always be marked as "unanswered" and become a Zombie Question that haunts the forum forever! Sep 15 '16 at 21:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .