abstract:In chess, a half-open file (or semi-open file) is a file with only pawns of one color. The half-open file can provide a line of attack for a player's rook or queen.
The fmemopen() functiongives you astdioFILE * object that refers to a buffer in memory. Replacing the open of test.jpg with a single call to fmemopen solves half the problem