[fpc-pascal] Creating text files with TFileStream

JoshyFun joshyfun at gmail.com
Fri Oct 23 13:33:36 CEST 2009


Hello Frank,

Friday, October 23, 2009, 12:50:22 PM, you wrote:

FP> If you want a text file, why do you not use a variable of type text,
FP> instead of a TFileStream? Text is what writes a text file. I think these
FP> streams are for saving object state, which means they are binary files

TFileStream, or in general TStream is much more versatile and powerful
than any kind of type based pascal Text file. They are binary streams,
yes, but that's exactly its power and as you can derive any class from
TStream you can add the methods to access them as plain text files
without any problem, the inverse is almost impossible.

FP> -- they only look like partial text files if the contents of the object
FP> looks partially like text. Trying to get them to do text files would be
FP> like trying to teach a pig to sing.

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.

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.

-- 
Best regards,
 JoshyFun




More information about the fpc-pascal mailing list