Sign in Join
FPDoc Onlineexperiment

WriteStr procedure

In unit System

Write variables to a string.

Declaration

pascal
procedure WriteStr(out S: string; Args: Arguments)

Description

WriteStr behaves like Write, except that it stores its output in the string variable S instead of a file. Semantically, the WriteStr call is equivalent to writing the arguments to a file using the Write call, and then reading them into S using the Read call from the same file:

var
  F : Text;
begin
  Rewrite(F);
  Write(F,Args);
  Close(F);
  Reset(F);
  Read(F,S);
  Close(F);
end;

Obviously, the WriteStr call does not use a temporary file.

WriteStr is defined in the ISO Extended Pascal standard. More information on the allowed arguments and the possible formatting can be found in the description of Write.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.