[Newbies] Reading and writing C structs
Ramiro Diaz Trepat
ramiro at diaztrepat.name
Tue Jul 1 23:45:35 UTC 2008
Yes, if you can load the contents on a ByteArray you can use the method:
array floatAt: position
It works just fine to read contents written from a C program, and I think it
is a bit simpler.
On Wed, Jul 2, 2008 at 12:36 AM, David Finlayson <dfinlayson at usgs.gov>
> Thanks. The following methods work, can they be improved/simplified?
> " returns a double "
> | n a b |
> a := self uint32.
> b := self uint32.
> n := Float new: 2.
> n at: 1 put: b.
> n at: 2 put: a.
> " returns a float "
> ^Float fromIEEE32Bit: self uint32.
> " Answer the next unsigned, 32-bit integer from this little endian
> (binary) stream "
> ^ aFileStream nextLittleEndianNumber: 4
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners