I wanted to create a certain file consisting of 8-bit bytes (to conform with a picture format).
In the following, the value of Q was always in the range 0-255. But the command
write(OUT, convert(UInt8,floor(Q)))
actually wrote zero-padded 16-bit bytes to the file OUT. Thus output file came out twice the size I expected. Indeed, using another programming language, I got the desired result by “dealing” 8-bit bytes (like card) between to two files (the other of which got filled with 0’s and thus subsequently discarded).
How can I write 8-bit bytes in Julia? I’m using Windows 10 on a 64-bit machine, if that makes a difference.
Thank you.