[Newbies] Reading and writing C structs

David Finlayson dfinlayson at usgs.gov
Tue Jul 1 23:36:29 UTC 2008

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

More information about the Beginners mailing list