[fpc-pascal] Creating text files with TFileStream

Frank Peelo f26p at eircom.net
Fri Oct 23 12:50:22 CEST 2009


On 23/10/2009 11:21, Graeme Geldenhuys wrote:
> 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. :-(
> 
> How difficult could it be to write a damn text file! :-)

If you want a text file, why do you not use a variable of type text, 
instead of a TFileStream? Text is what writes a text file. I think these 
streams are for saving object state, which means they are binary files 
-- they only look like partial text files if the contents of the object 
looks partially like text. Trying to get them to do text files would be 
like trying to teach a pig to sing.

FP





More information about the fpc-pascal mailing list