EasyManua.ls Logo

Crestron SIMPL+ - Page 149

Crestron SIMPL+
374 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Crestron SIMPL+
®
Software
Language Reference Guide - DOC. 5797G SIMPL+
®
z 139
Examples:
(Refer to "File Functions Overview"on page 116)
Example 1: Open a read only file:
SIGNED_INTEGER nFileHandle;
StartFileOperations();
nFileHandle = FileOpen ( “MyFile”, _O_RDONLY );
IF (nFileHandle < 0)
{
PRINT(“Error Opening File MyFile\n”);
}
EndFileOperations();
Example 2: Open an existing file to log data to the end
SIGNED_INTEGER nFileHandle;
StartFileOperations();
nFileHandle = FileOpen ( “MyFile”, _O_WDONLY | _O_APPEND);
IF (nFileHandle < 0)
{
PRINT(“Error Opening File MyFile\n”);
}
EndFileOperations();
Example 3: Truncate an existing file and get rid of previous contents. If it does not
exist, create it.
SIGNED_INTEGER nFileHandle;
StartFileOperations();
nFileHandle = FileOpen ( “MyFile”, _O_WDONLY | _O_CREAT |
_O_TRUNC);
IF (nFileHandle < 0)
{
PRINT(“Error Opening File MyFile\n”);
}
EndFileOperations();
Example 4: Continue adding to the end of an existing log file, or create it if it does
not already exist.
SIGNED_INTEGER nFileHandle;
StartFileOperations();
nFileHandle = FileOpen ( “MyFile”, _O_WDONLY | _O_APPEND
| _O_CREAT);
IF (nFileHandle < 0)
{
PRINT(“Error Opening File MyFile\n”);
}
EndFileOperations();

Table of Contents

Other manuals for Crestron SIMPL+

Related product manuals