[fpc-pascal] Creating text files with TFileStream

Mattias Gärtner nc-gaertnma at netcologne.de
Fri Oct 23 13:40:40 CEST 2009


Zitat von Graeme Geldenhuys <graemeg.lists at gmail.com>:

> 2009/10/23 Graeme Geldenhuys <graemeg.lists at gmail.com>:
>>
>>> Did you try writing with WriteBuffer(Atext[1], length(AText)?
>>
>> That works exactly like I intended. Thanks Gerard.
>
> I spoke to soon! :-(
>
> I can view the resulting output.txt file with Midnight Commander
> (Linux console file manager), but if I try and open that file with
> Gnome gEdit or Lazarus IDE, it says the file does not look like a text
> file and refuses to open it. :-(

It means your AText string contains special characters (#0..#8,#11,#14..#31)


> How difficult could it be to write a damn text file! :-)

It's damn simple.
Use TFileStream if you want write one string.
Use a TStringList if you want to write several strings.


Mattias





More information about the fpc-pascal mailing list