On Fri, 5 Nov 2010, Mateusz Grotek wrote:
> How to write Floats to a file. Is using at:1 and at: 2 the only method
> of doing it. If so, why there is no support for Float writing in streams?
If the file is binary, then you can use #nextWordsPutAll:. Here's an
example:
FileStream newFileNamed: 'BinaryFloatTest.txt' do: [ :file |
file binary.
file nextWordsPutAll: 1.2345 ].
It will store the words in big-endian format.
If the file is not binary, then you can use #printOn: or #storeOn::
FileStream newFileNamed: 'FloatTest.txt' do: [ :file |
1.2345 printOn: file ].
Levente
>
> _______________________________________________
> Beginners mailing list
>
[hidden email]
>
http://lists.squeakfoundation.org/mailman/listinfo/beginners>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners