still stuck on recover.
Valgrind is saying I have an uninitialized value when I call fwrite. I'm not sure why. I've read through all the segfault issues on here and can't seem to find one that references fwrite.
So I've got
BYTE s[512] as a 'buffer' fread(s,512 * sizeof(BYTE), 1, ptr) fwrite(s,512 * sizeof(BYTE), 1, jpg_file_ptr)
I get a segfault and Valgrind helpfully suggests I have unitialized values of size 8:
==2963== Use of uninitialised value of size 8
==2963== at 0x51ABDA0: fwrite (iofwrite.c:41)
==2963== by 0x4009E2: main (recover.c:84)
==2963==
==2963== Use of uninitialised value of size 8
==2963== at 0x51ABDAF: fwrite (iofwrite.c:41)
==2963== by 0x4009E2: main (recover.c:84)
==2963== ==2963== Invalid read of size 8
==2963== at 0x51ABDBF: fwrite (iofwrite.c:41)
==2963== by 0x4009E2: main (recover.c:84)
==2963== Address 0x8 is not stack'd, malloc'd or (recently) free'd
Can someone explain why? I've gone through pointers and file I/O again and am still stuck. Basically frustrated to still be stuck on this problem 3 days later...
Code here (while problem is open): http://pastebin.com/ADLZvbbx
(Bottom code can be ignored -- previous approach)
Thanks all!