Difference between revisions of "WriteFileString"

From SCAR Divi Manual
Jump to: navigation, search
 
Line 38: Line 38:
 
*[[WriteFileInt]]
 
*[[WriteFileInt]]
 
*[[RewriteFile]]
 
*[[RewriteFile]]
 +
*[[AppendFile]]
 
*[[CloseFile]]
 
*[[CloseFile]]
  
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:File Functions]]
 
[[Category:File Functions]]

Latest revision as of 00:24, 3 November 2011

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