0

My program restores 16 images but only the first 8 seems to be in the right format. The size of the eight images that have not been restored successfully are all 1024 bytes. Any help would be really appreciated. Thanks

-rw------- 1 jharvard students 151552 Nov 5 01:15 000.jpg

-rw------- 1 jharvard students 196608 Nov 5 01:15 001.jpg

-rw------- 1 jharvard students 163840 Nov 5 01:15 002.jpg

-rw------- 1 jharvard students 90112 Nov 5 01:15 003.jpg

-rw------- 1 jharvard students 167936 Nov 5 01:15 004.jpg

-rw------- 1 jharvard students 81920 Nov 5 01:15 005.jpg

-rw------- 1 jharvard students 307200 Nov 5 01:15 006.jpg

-rw------- 1 jharvard students 143360 Nov 5 01:15 007.jpg

-rw------- 1 jharvard students 1024 Nov 5 01:13 008.jpg

-rw------- 1 jharvard students 1024 Nov 5 01:13 009.jpg

-rw------- 1 jharvard students 1024 Nov 5 01:13 010.jpg

-rw------- 1 jharvard students 1024 Nov 5 01:13 011.jpg

-rw------- 1 jharvard students 1024 Nov 5 01:13 012.jpg

-rw------- 1 jharvard students 1024 Nov 5 01:13 013.jpg

-rw------- 1 jharvard students 1024 Nov 5 01:13 014.jpg

-rw------- 1 jharvard students 1024 Nov 5 01:13 015.jpg

1
  • Have you looked at the headers of the files? Do they contain valid JPEG signatures? Have you inspected the contents of the files? Could they possibly contain multiple JPEG files in a single file? If you add up the size of the valid files, how does this compare to the size of the data file? Could your program possibly be reading the blocks in sizes of 1024 bytes and not 512 bytes? Have you perhaps declared your buffer as an array of int (which could be 4 bytes) instead of the platform-neutral uint_8? – Luke Van In Nov 15 '15 at 12:37
0

Problems with 8 files (missing or incorrect) usually indicate an issue with two (or more) freads, or a case where every other file creation has a problem.

However, yours are the last 8 files that are bad. The fact that this happens after 8 files is highly suspicious for two reasons - because it processed exactly 8 files correctly before going bad, and because it happened between two files having the second signature.

Impossible to tell anything further without seeing your while loop and any related declarations.

If this answers your question, please click the check mark to accept the answer. Let's keep up on forum maintennace. ;-)

You must log in to answer this question.

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