0

I recovers all the 50 images and check my program correctness through check50. but it fails last three test can you check my code and tell me where i'm wrong

here's the check50 error

:) recover.c exists

:) recover.c compiles

:( recovers 000.jpg correctly
   \ expected an exit code of 0, not output of "memory card does'nt open correctly\nins..."

:( recovers 001.jpg through 048.jpg correctly
   \ expected an exit code of 0, not output of "memory card does'nt open correctly\nins..."

:( recovers 049.jpg correctly
   \ expected an exit code of 0, not output of "memory card does'nt open correctly\nins..."

and here is my source code ----

/* * * * * * * * * */

// including standard libraries 
#include<stdio.h>
#include<stdint.h>
#include<stdlib.h>

typedef uint8_t BYTE ;

// defining jpg section according to FAT system 
#define BLOCKSIZE 512 

int main ( void ) 

{
   // opens the memory card file or say the forensic image of the card 
   FILE* cfcard = fopen ( "newcard.raw" , "r" ) ;

   // check that the file is open correctly 
   if ( cfcard == NULL ) 
   {
      printf("memory card does'nt open correctly\ninsufficient memory\n");
      return 1 ;
   } 

[snip remainder]

1

The check50 results tell you what's happening:

expected an exit code of 0, not output of "memory card does'nt open correctly\nins...

Look at your code. You return that print when it fails to open the card. So that points to your problem. As it says in the spec:

For simplicity, you should hard-code "card.raw" in your program; your program need not accept any command-line arguments. When executed, though, your program should recover every one of the JPEGs from card.raw, storing each as a separate file in your current working directory.

According to your code snippet, you have not done that. As a consequence, check50 cannot open the file and you fail those tests.

1

The same happened to me, had forgotten to close the old output file before opening a new one.

You must log in to answer this question.

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