read_device_spec_file
status.i4.v = read_device_spec_file(file_name.i1a.r,
device_names.i1p.r,
device_indices.i4p.r,
property_indices.i2p.r,
lengths.i2p.r,
offsets.i2p.r)
This routine reads an ASCII file containing ACNET device
specifications and returns the list of devices. Property indices,
device lengths, and offsets 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
m:outtmp prread 2 0
g:sctime s 2 0
t:ha11 prset 8 2
file_name null terminated ASCII file name (including path)
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
lengths returned array of lengths
offsets returned array of offsets
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
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_c_style_device_file, read_tagged_value_file,
read_logger_device_file, dio_device_index(_c), dio_data_len(_c)
C/C++ usage:
static const char file_name[] = "myfile.txt";
char *device_names;
short *property_indices;
short *lengths;
short *offsets;
int status;
int *device_indices;
status = read_device_spec_file(file_name,&device_names,
&device_indices,&property_indices,
&lengths,&offsets);