
On Wednesday 08 January 2003 2:29 pm, Simon Marlow wrote:
Hope I'm not being to stupid here, but I think there's a portability problem with these functions for anything other than byte oriented data because the endian mode in memory is system dependent whereas for files it will depend on the format specified for the file.
Personally, I don't see a problem here. hPutBuf is defined to write a sequence of bytes to a file, and that's exactly what it does: the interpretation of the sequence of bytes is an orthogonal issue.
Well if there were other functions available for reading/writing sequences 16,32,64 bits that would fine. But there aren't at present, unless users write their own bit diddling code to do it. (Which they'll probably be disinclined to do if writing a little endian file on a little endian system :-)
We should certainly also provide ways to write binary data into a file in a portable way... but IMO that should be part of the Binary library which is currently being worked on.
OK, I wasn't aware of that. Regards -- Adrian Hey