XPRBreadarrlinecb
Purpose
Synopsis
int XPRBreadarrlinecb(char *(*fgs)(char *,int,void *), void *file, int length, const char *format, void *arrc, int size);
Arguments
|
fgs
|
|||||||||||||
|
file
|
Pointer to a data file.
|
||||||||||||
|
length
|
Maximum length of any text string to be read.
|
||||||||||||
|
format
|
String indicating the format of the data file to be read, consisting of one of the listed values followed by a separator sign:
|
||||||||||||
|
arrc
|
Array of size at least
size that receives the data that are read.
|
||||||||||||
|
size
|
Maximum number of data items to be read.
|
Return value
Number of data items read.
Example
double vlist[10];
FILE *datafile;
...
datafile=fopen("filename", "r");
XPRBreadlinecb(XPRB_FGETS, datafile, 120, "g ", vlist, 6);
fclose(datafile);
This opens a data file and reads a line of six double values separated by spaces, before closing the file.
Further information
This function reads tables from data files in a format compatible with the
diskdata command of mp-model and Mosel. Data lines in the input file may be continued over several lines by using the line continuation sign
&. The input file may also contain comments (preceded by
!) and empty lines, both of which are skipped over. The data file is accessed with standard C functions ( fopen,
fclose). The function reads up to
size data items of the type indicated by the format parameter. All string types in the format may (optionally) be followed by the maximum string length to be read. Otherwise the maximum length is assumed to be length. The type of separator signs (
e.g.
,
;
:) used in the data file needs to be given after the format option(s). Array arrc is an array of the same type as the data to be read (
int *,
char *, or
double *) and of size at least
size. With function
XPRBsetdecsign the decimal sign used in the data input may be changed, for instance to use a decimal comma.
Related topics
© 2001-2021 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation ("FICO"). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.
