read_device_file
status.i4.v = read_device_file(file_name.i1a.r, device_names.i1p.r,
device_indices.i4p.r,
property_indices.i2p.r,
array_indices.i4p.r)
This routine reads an ASCII file containing ACNET device names and
returns the list of devices. Property indices can also be returned.
This routine allocates the memory for the returned data arrays.
The caller should NOT free this memory. It is cached until the
next call to this routine. Any of the returned arguments can
be defaulted by passing a value of NULL.
An example of a valid file is as follows:
! This is a comment
# This is also a comment
m:outtmp prread
m:outdoor_temperature prread
g:sctime s
t:ha11.setting[3]
z:acl_test_device.reading[2]
t:ha11[12] prset
t:ha11>12 prset
file_name null terminated ASCII file name (including path)
(If this string is actually a URL, the web page
will be read as a device file.)
device_names returned array of ACNET device names
(DEVICE_NAME_LEN characters per entry)
device_indices returned array of device indices
property_indices returned array of property indices
array_indices returned array of device array indices
This function returns status values as follows:
CLIB_NOTOPN failed to open the source file
CLIB_MEMFAIL failed in allocating dynamic memory
CLIB_NO_SUCH no devices found in the file
CLIB_SYNTAX invalid syntax encountered
DBM_xxx invalid, obsoleted, or deleted device
encountered
otherwise number of devices returned
This function requires the following include files:
cnsparam_h, cbslib_h, acnet_errors_h
Related functions:
read_c_style_device_file, read_device_spec_file,
read_tagged_value_file, read_logger_device_file, dio_device_index(_c)
C/C++ usage:
static const char file_name[] = "myfile.txt";
char *device_names;
short *property_indices;
int status;
int *device_indices;
int *array_indices;
status = read_device_file(file_name,&device_names,&device_indices,
&property_indices,&array_indices);