by ori_b · 9y ago · 0 comments
Mmap doesn't work with pipes, which hugely reduces the utility of this kind of program.
Which is why you don't read to the end (until you have an EOF). You can just sidestep the partial sequence problem by getting more data before there's potential for a partial sequence to show up. The longest possible sequence is 4 bytes, so as long as you ensure you have 4 bytes available, partial sequences are impossible on well formed input.