![background image](http://html1.mh-extra.com/html/advantech/ubiq/ubiq_user-manual_2856809076.webp)
UbiQ Scenario Manager User Manual
70
5.2.18
open
Syntax
int open(char* pFilename,int open_type) or
int open(string sFilename,int open_type)
Parameters
pFilename: Specifies the Null-ended character array filename. A array that is
the path to the desired file. The path must be absolute.
sFilename: Specifies the filename string. A string that is the path to the desired
file. The path must be absolute.
Description
This function returns a file handle for the opened file. A return value of 0 indi-
cates an error.
Comments
The open function opens the file specified by filename and prepares the file for
reading or writing, as specified by open_flag:
Example
int hFile;
hFile=open(“\\flash storage\\template.txt”, FILE_CREATE_RW);
setdebug(TRUE);
if (hFile==0) {
debug(“Open file failed!”);
}
else {
close(hFile);
}
See Also
read, write, close, seek, readln, writeln, filecopy, eof
open_flag
description
FILE_READ
Opens the file for reading only
FILE_RDWR
Opens the file for reading and writing
FILE_CREATE_NEW
Create a new file. If the file exists already, it is truncated to 0
length.
FILE_CREATE_RW
Create a new file. If the file being created already exists, it is not
truncated to 0 length. Thus the file is guaranteed to open, either as
a newly created file or as an existing file. This might be useful, for
example, when opening a settings file that may or may not exist
already.
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...