[q-lang-users] null problemo
Brought to you by:
agraef
From: Tim H. <q...@st...> - 2004-08-16 18:41:35
|
Hiya, I'm trying to write a little utility to read & (manipulate &) write PNM bitmap image files. Reading is OK but I've had to declare that `ord ""=0' around my reader function[1]; I'm having serious problems writing the ascii NUL byte out - have tried declaring that `chr 0="\0"' and other variations on a theme, but every time I try to fwritec the thing, the file truncates prematurely; running hexdump shows that no byte in the output is set to 00. I'm unhappy about the `ord ""=0' trick - I would not have expected NUL to be converted to an empty string, rather to "\0", of course. I've also found that trying to embed a NUL in the script source causes syntax errors etc, as presumably the interpreter is seeing that as EOF. Sources for perusal are at <http://spodzone.org.uk/temp/q-pnm.tgz>. Is there an official way to handle this? Cheers, ~Tim Footnotes: [1] I had to do this before, as in a `where' clause it had no effect... this also felt untidy. [2] this is last day before going on holiday; please excuse a delay to any responses... -- <http://spodzone.org.uk/> |