PDA

View Full Version : libBinaryIO


OneSadCookie
2003.04.28, 12:07 AM
Well, I was doing some binary I/O in Ruby, and it was supremely easy. And then it occurred to me that binary I/O needn't be as hard as it is in C/C++, so I wrote a little library:

libBinaryIO
http://203.79.121.211/CVS/

It's a work in progress, it may be buggy, there are features that need adding, &c, but I've successfully used it and liked using it, so I though it might be useful to people here.

Suggestions, bug reports, &c welcome, of course!

Johan
2003.04.28, 07:48 AM
Works like a charm. The little-endian unpack option is just great.

Would it be possible to add the option of reading 'n' bytes (n < sizeof(type) ) to any type. For example it would be nice to read a 24bit BGR pixel into one int.

Something like:

uint32 *buffer;
// Read 256 24bit BGR pixels into ARGB buffer;
funpackf(file, "L256i3", buffer);

Anyways, great work.

.johan

OneSadCookie
2003.04.28, 07:58 AM
henryj wants the ability to do bitfields, which seems similar. The interface we were talking about, though, doesn't give you enough flexibility to do what you want...

I'll think about it :)