[fpc-pascal] TStringStream.DataString returns garbage?

Marco van de Voort marcov at stack.nl
Fri Feb 3 10:31:32 CET 2012


In our previous episode, michael.vancanneyt at wisa.be said:
> > On textfiles you only stream contents, on binary files usually a length
> > field (which can be 1,2,4 bytes depending on format) + contents.
> 
> The latter exists:
> 
> http://www.freepascal.org/docs-html/rtl/classes/tstream.writeansistring.html
> 
> We could make an optional parameter "AsText : Boolean = False" which would
> then write the former.
> 
> Downside is that the 'read' operation will not be able to read the text form.

If necessary I would simply add a separate version "writetext", and not
multiplex it on writeansistring.  But as said this is all a slippery slope,
specially with unicode profileration ahead.  We are going writeunicodestring
sooner or later :-)




More information about the fpc-pascal mailing list