WriteFileString

From SCAR Divi Manual
Jump to: navigation, search

Definition

function WriteFileString(FileNum: Integer; const s: string): Boolean;

Availability

SCAR Divi 3.00 > Current

Description

Writes a string s to an open file stream with writing privileges associated with the index FileNum in the file stream resource manager. Returns false if the writing failed or the index FileNum is invalid. The file stream should have been created with RewriteFile.

Example

var
  f: Integer;
  s: string;

begin
  f := Rewritefile(LogsPath + 'Test.txt', False);
  WriteFileString(f, 'Hello World!');
  CloseFile(f);

  f := OpenFile(LogsPath + 'Test.txt', False);
  ReadFileString(f, s, FileSize(f));
  WriteLn(s);
  CloseFile(f);

  DeleteFile(LogsPath + 'Test.txt');
end.

Output:

Hello World!

See Also