read_c_style_device_file
status.i4.v = read_c_style_device_file(file_name.i1a.r,
device_names.i1p.r,
device_indices.i4p.r,
property_indices.i2p.r,
array_indices.i4p.r,
end_indices.i4p.r)
This routine reads an ASCII file containing ACNET device names and
returns the list of devices. 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
m:outtmp
g_sctime
t_ha11[12]
t_ha11[12:15]
t_ha11[]
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
end_indices returned array of ending device array indices
(A value of 0 indicates that no end index was supplied.)
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_device_file, read_device_spec_file, read_tagged_value_file,
read_logger_device_file, dio_device_index(_c),
dio_parse_long_device_name_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;
int *end_indices;
status = read_c_style_device_file(file_name,&device_names,
&device_indices, &property_indices,
&array_indices,&end_indices);