Skip to content

ReadStr

Read variables from a string

Declaration

Source position: system.fpd line 88

  procedure ReadStr(const S: string; Args: Arguments);

Description

ReadStr behaves like Read , except that it reads its input from the string variable S instead of a file. Semantically, the ReadStr call is equivalent to writing the string to a file using the Write call, and then reading them into the various arguments Arg using the Read call from the same file:

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

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

ReadStr is defined in the ISO Extended Pascal standard. More information on the allowed arguments and the behaviour of the arguments can be found in the description of Read .

See also

Name Description
Read Read from a text file into variable
Write Write variable to a text file or standard output
WriteStr Write variables to a string