[fpc-pascal] Writing floating points to steams

Torsten Bonde Christiansen tc at epidata.info
Tue Jan 12 13:40:45 CET 2016

On 2016-01-12 12:38, Michael Van Canneyt wrote:
> On Tue, 12 Jan 2016, Torsten Bonde Christiansen wrote:
>> On 2016-01-12 12:04, Graeme Geldenhuys wrote:
>>> On 2016-01-12 10:45, Torsten Bonde Christiansen wrote:
>>>> Since TStream doesn't have any native WriteFloat/Double and the likes,
>>>> some conversion is needed - but what is a good strategy for this?
>>> I use FloatStr() to do the conversion, then Write() to actually 
>>> write it
>>> to a stream.
>>> Regards,
>>>    - Graeme -
>> In my case I am trying to write a datetime value, and in order not to 
>> worry about the format, separators, etc. i would much rather just 
>> write the actual floating point value...
> Format the date/time as RFC3339 or ISO 8601 (they differe in details 
> only) and you should not have a problem. ScanDateTime from strutils 
> will happily
> perform the opposite operation.
I will give it a try.

But out of curiosity is there a reason why there are not floating point 
Read/Write methods for TStream (and decendants)?


More information about the fpc-pascal mailing list