Crestron simpl plus language ref 사용자 설명서

다운로드
페이지 374
Crestron SIMPL+
®
Software 
Language Reference Guide - DOC. 5797G
 SIMPL+
®
 
z 143
FileSeek
Name:
FileSeek
Syntax:
SIGNED_INTEGER FileSeek (INTEGER handle, LONG_INTEGER 
offset, INTEGER origin )
Description:
Positions the current file pointer. 
Parameters:
HANDLE specifies the file handle of previously opened file (from FileOpen). 
OFFSET specifies the number of bytes to move relative to the origin. 
ORIGIN is on of the file seek flags in the following table. 
FileSeek Flags:
Return Value:
Number of bytes offset from the beginning of file. Otherwise, file error code is 
returned.
Example: 
(Refer to "File Functions Overview"on page 
)
SIGNED_INTEGER  nFileHandle; 
StartFileOperations();
nFileHandle = FileOpen(“MyFile”, _O_RDONLY); 
IF (nFileHandle >= 0) 
{
IF (FileSeek( nFileHandle, 0, SEEK_SET)) < 0 ) 
PRINT ( “Error seeking file\n” );
IF ( FileClose ( nFileHandle ) <> 0 ) 
PRINT ( “Error closing file\n” ); 
EndFileOperations();
}
KEYWORD
FUNCTION
SEEK_SET
Start seeking from beginning of file
SEEK_CUR
Start seeking from current position in file
SEEK_END
Start seeking from end of file