0

I created a struct

    typedef struct
{
    BYTE  buffer[512];

} __attribute__((__packed__))
BUFFER;

then I try reading card.raw and writing to a new file in a while loop

fread(&photo, sizeof(BUFFER), 1, card);
fwrite(&photo, sizeof(BUFFER), 1, outptr);

when I run it in gdb and do p /x photo the values for photo never change

screenshot of p/x photo

I have tried doing fseek in front fread and still get the same thing, I tried doing

fread(&photo, sizeof(BYTE), 512, card)

please if anyone can explain why this is happening or point me too where I can find an answer I would really appreciate it. Let me know if I can provide more info, didn't want to just paste all my code here

0

I erased the contents of card.raw by mistake and what I was seeing was garbage values when i created my photo struct, thats why they never changed

| improve this answer | |

You must log in to answer this question.

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