From Clomosy Docs

(Created page with "<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert"> procedure ReWrite(var FileHandle TextFile); </div> Opening the file in write mode erases its content and prepares it to write new data.<br> The file created with AssignFile is opened with ReWrite using the file name specified in the directory where the Clomosy Learn application is located.<br> <div class="alert alert-danger" role="alert" data-bs-theme="light"> If...")
 
No edit summary
Line 8: Line 8:
<div class="alert alert-danger" role="alert" data-bs-theme="light">
<div class="alert alert-danger" role="alert" data-bs-theme="light">
If the created file is already in the directory, an error will occur when calling `ReWrite`. Before using `ReWrite`, it should be checked whether the file exists.
If the created file is already in the directory, an error will occur when calling `ReWrite`. Before using `ReWrite`, it should be checked whether the file exists.
</div>
<div class="alert alert-danger" role="alert" data-bs-theme="light">
While the `ReWrite` procedure erases the data in the created file and writes new data over it, the `[[Append]]` procedure does not delete the file content and continues to add data to the end of the file.
</div>
</div>



Revision as of 11:14, 23 October 2024

Opening the file in write mode erases its content and prepares it to write new data.
The file created with AssignFile is opened with ReWrite using the file name specified in the directory where the Clomosy Learn application is located.

Example
TRObject Syntax

var
  file1 : TextFile;
{
  AssignFile(file1, 'Test.txt');
  ReWrite(file1);
}

Base Syntax

var
  file1 : TextFile;
begin
  AssignFile(file1, 'Test.txt');
  ReWrite(file1);
end;

See Also