Hot answers tagged

1

First, when your program reaches line 74, you already have a file open that has it's location stored in a pointer you named img. When your program goes to write to this, it does not try to reopen it or recalculate where that pointer should be going to using the path that you have laid out. Instead, it reads the location that is stored within img even though ...


1

The while executes an fread followed immediately by an fread. What is likely happening is: program never finds a jpeg signature because it is only processing every other block. Therefore, no img file is opened, therefore the close gives a seg fault.


Only top voted, non community-wiki answers of a minimum length are eligible