Difference between revisions of "Extensions.File.CloseFile"

From emotive
Jump to navigation Jump to search
Line 18: Line 18:
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie1| handle| [[Extensions.File.FileHandle|FileHandle]] | [[Variable]] | - | [1..1] | The handle for the file that the related file object encapsulates.}}
+
{{TableRowPropertie2| handle| [[Extensions.File.FileHandle|FileHandle]] | [[Variable]] | - | [1..1] | The handle for the file that the related file object encapsulates.}}
 
|}
 
|}
  

Revision as of 03:47, 27 September 2018

Classification

Name CloseFile
Short Description Closes the current file
Class Action
Extension OTX File extension
Group File related Actions
Exceptions FileSaveException
InvalidReferenceException
Checker Rules -
Standard Compliant Yes

OTL Syntax

File.CloseFile(FileHandleVariable);

Description

The CloseFile closes the current file and releases any resources associated with the current file. In the case of a FileWriteHandle, the file will be saved before closing. The use of CloseFile is optional. An OTX runtime system shall automatically close any open FileHandles at the end of a diagnostic session, saving the file in case of a FileWriteHandle.

If a diagnostic sequence uses a FileHandle after it has been closed by a CloseFile action, the runtime system shall throw an otx:InvalidReferenceException.

If saving failed, the FileSaveException exception will be thrown.

Properties

Name Data Type Class Default Cardinality Description
handle FileHandle Variable - [1..1] The handle for the file that the related file object encapsulates.

OTL Examples

File.FileReadHandle FileReadHandle;

/// Flow

FileReadHandle = File.OpenFileForRead("file:///D:/abc.txt", @Encoding:UTF-8);
File.CloseFile(FileReadHandle);

See also

Delete
SaveFile
WriteBytes
WriteFile
WriteLine