BYVoid/OpenCC — pull request #16 by rueycheng (2013-02-18 19:22:16+00:00)
Title: Replace the fseek() call with a true lookahead buffer in tools/opencc.c

When piping input from stdin (such as 'cat somefile | opencc'), the fseek() trick used in tools/opencc.c no longer works because stdin is seekable. I suggest using a lookahead buffer in place of the fseek call. The idea is simple: move the tail (the extra bytes) to a new buffer and move it back to the front of buffer_in in the coming iteration. Check the orphan right after the loop ends.

A tiny fix to some error (incorrect bit offset) in encoding.c is also available here.