chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Fwd: Peeking N characters in string ports


From: Vasilij Schneidermann
Subject: Re: [Chicken-users] Fwd: Peeking N characters in string ports
Date: Fri, 11 Jan 2019 14:23:53 +0100

Hello David,

I've run into a similar problem when trying to detect magic bytes for
unknown image formats.  Most allowed figuring out the format by checking
four bytes, one after three bytes.  I've solved this problem by
rethinking it a bit, first read in three bytes and compare, if it's not
the three bytes format, read in one more byte and check the remaining
signatures against the combination of the last three bytes and the
fourth one.  While this was slightly more verbose than an `unread-char`
solution, it was still simple enough to understand.

Vasilij

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]