[fpc-pascal] Creating text files with TFileStream
Graeme Geldenhuys
graemeg.lists at gmail.com
Fri Oct 23 13:50:34 CEST 2009
2009/10/23 JoshyFun <joshyfun at gmail.com>:
>
> Since Delphi first streams I had never used pascal "files" anymore,
> they are a lot of restrictive, not thread safe and are very tied to
> which they expect to read/write.
That's kind-of why I wanted to use TFileStream. I use it for reading
binary data, and thought to use it for writing text data. I always
used to use Text type though.
> Graeme's problem seems to be that he is writting UTF-8 text files
> without UTF-8 BOM. If the text presents high ascii chars the file will
> look to not text to some "inteligent" editors.
The problem was a rogue WriteAnsiString() line in another unit which
wrote the string length before the text. And because that was the
first line in the output file, it seems to have confused most text
editors. Changing all the lines to use the correct .Write() call and
parameter syntax, everything is working fine now.
--
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the fpc-pascal
mailing list