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
signature.asc
Description: PGP signature
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users