Guys the problem is that although I am getting all the images, the filename is not proper. I have searched thoroughly and found that you have to use %03d but when i use it I just get 000.jpg and 001.jpg. All images are rendering properly. Please advise. Since I dont know where the problem lies I am posting my whole code

int main(int argc, char* argv[])
    //opening input file
    FILE* inptr = fopen("card.raw", "rb");
    if (inptr == NULL)
        printf("Could not open card");
        return 1;

    //some declarations
    uint8_t buffer[512];
    int counter = 0;
    char title[7];
    FILE* outptr = NULL;

your code looks good, but you might keep in mind the character string end, so I change it to char title[8], note that sprintf writes the character '\ 0' at the end, and you tell me if it works.

  • Thanks that solved it. Forgot the '\0' – NbrKn Jun 17 '16 at 18:40
  • Welcome to the boat !, I'm glad it works – MARS Jun 17 '16 at 19:42

You must log in to answer this question.

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