brettnem: use pack to construct that sf_hdr thing, then just write $header and $data behind it.