3

First, on the first pass through the while loop, you attempt to write to img before any output file has been opened. That's triggering the seg fault. Once that's fixed, there are more problems. You are doing back to back reads at the top of the program, so you will skip processing the first block. If it had a signature, you'd miss a file. (They should ...


1

Haven't seen the $$ operator before. Maybe you meant &&, which is logical AND.


1

Instead of if ( ((tile_row == cursor_row-1) && (tile_column == cursor_column)) || ((tile_row == cursor_row)) && ((tile_column == cursor_column-1)) || ((tile_row == cursor_row)) && ((tile_column == cursor_column+1)) || ((tile_row == cursor_row+1)) && ((tile_column ...


1

in C, the logical AND operator (&&) has higher precedence than the logical OR operator (||). see C Operator Precedence! this means that && operators get evaluated before || operators. for example: a && b || c gets evaluated as (a && b) || c not a && (b || c) the two expressions are different. here are their ...


1

When you exit your do-while block, this is what buffer holds: p/x buffer $11 = {0xf8, 0xff, 0xff, 0xf, 0xff, 0xff, ... If you look closely, you'll notice this doesn't match the jpg header: Specifically, the first four bytes of most JPEGs are either 0xff 0xd8 0xff 0xe0 or 0xff 0xd8 0xff 0xe1 You'll also notice that oddly, this line never executes: ...


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