![Advantech UbiQ User Manual Download Page 83](http://html1.mh-extra.com/html/advantech/ubiq/ubiq_user-manual_2856809083.webp)
77
UbiQ Scenario Manager User Manual
Chapter 5
Functions
Reference
5.2.23
seek
Syntax
int seek(int hFile,int nFrom, int nOffset)
Parameters
hFile: Specifies the handle referring to open file
nFrom: Specifies the Pointer movement mode.
nOffset: Specifies the number of bytes to move the pointer
Description
This function returns the new byte offset from the beginning of the file. A return
value of -1 indicates an error.
Comments
Pointer movement mode must be one of the following values:
Example
int hFile;
int nLen;
char data[512];
hFile=open(“\\flash storage\\template.txt”, FILE_CREATE_RW);
setdebug(TRUE);
if (hFile==0) {
debug(“Open file failed!”);
}
else {
// process the file
seek(SEEK_END,0);
data=”This is a test file.”;
nLen=write(hFile, data, strlen(datta));
close(hFile); // close the file
}
See Also
open, close, read, write, readln, writeln, filecopy, eof
SEEK_BEGIN
Move the file pointer nOffset bytes forward from the beginning of
the file.
SEEK_END
Move the file pointer nOffset bytes from the end of the file. Note
that nOffset must be negative to seek into the existing file; positive
values will seek past the end of the file
SEEK_CURRENT
Move the file pointer lOff bytes from the current position in the file.
Summary of Contents for UbiQ
Page 1: ...User Manual UbiQ Scenario Manager User Manual V1 03...
Page 4: ...UbiQ Scenario Manager User Manual iv...
Page 7: ...Chapter 1 1 Introduction...
Page 13: ...Chapter 2 2 Getting Started...
Page 37: ...Chapter 3 3 Tutorials...
Page 47: ...Chapter 4 4 Basic of Smart C Script Language...
Page 62: ...UbiQ Scenario Manager User Manual 56...