[fpc-pascal] Creating text files with TFileStream

Aleksa Todorovic alexione at gmail.com
Fri Oct 23 12:33:53 CEST 2009


On Fri, Oct 23, 2009 at 12:25, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
>
> Anyway, so now I'm back to square one - unable to create a plain text
> file with TFileStream. :-(
>

What about:

TFileTextStream = class(TFileStream)
constructor Create...;
procedure WriteStr(const fmt: String; const args: array of const);
procedure WriteStr(const s: String);
end;

procedure TFileTextStream.WriteStr(const fmt: String; const args:
array of const);
var
  temp: String;
begin
  temp := Format(fmt, args);
  Write(temp[1], Length(temp));
end;

procedure TFileTextStream.WriteStr(const s: String);
begin
  WriteStr('%s', [s]);
end;

[written out of head, but it should work]


-- 
Aleksa Todorovic - Lead Programmer
Eipix Entertainment
http://www.eipix.com/



More information about the fpc-pascal mailing list