After
this discussion with Lee I thought it would be impossible to write a binary file from scratch. But then I had a tiny brainwave: It can be done if you use a a small binary file containing all byte values (0 - 255 inclusive) as a "lookup table".
Most likely this is a case of reinventing the wheel, but if you want to give it a try:
Put the two files from the zip in the same folder.
Open a dwg in that folder and load the lisp.
The test function (c:TestFlag) should create a small bmp file in the current folder.
Edit: Typo.