XPRS_nml_getnames
XPRS_nml_getnames |
Purpose
The
XPRS_nml_* functions provide a simple, generic interface to lists of names, which may be names of rows/columns on a problem or may be a list of arbitrary names provided by the user. The
XPRS_nml_getnames function returns some of the names held in the name list. The names shall be returned in a character buffer, and with each name being separated by a
NULL character.
Synopsis
int XPRS_CC XPRS_nml_getnames(XPRSnamelist nml, int padlen, char buf[], int buflen, int* r_buflen_reqd, int firstIndex, int lastIndex);
Arguments
nml
|
The namelist object.
|
padlen
|
The minimum length of each name. If
>0 then names shorter than
padlen will be concatenated with whitespace to make them this length.
|
buf
|
Buffer of length
buflen into which the names shall be returned.
|
buflen
|
The maximum number of bytes that may be written to the character buffer
buf.
|
r_buflen_reqd
|
A pointer to a variable into which will be written the number of bytes required to contain the names. May be NULL if not required.
|
firstIndex
|
The index of the first name in the namelist to return. Note name list indexes always start from 0.
|
lastIndex
|
The index of the last name in the namelist to return.
|
Example
XPRSnamelist mylist; char* cbuf; int o, i, cbuflen; ... /* Find out how much space we'll require for these names */ XPRS_nml_getnames(mylist, 0, NULL, 0, &cbuflen, 0, 5 ); /* Allocate a buffer large enough to hold the names */ cbuf = malloc(cbuflen); /* Retrieve the names */ XPRS_nml_getnames(mylist, 0, cbuf, cbuflen, NULL, 0, 5); /* Display the names */ o=0; for (i=0;i<6;i++) { printf("Name #%d = %s\n", i, cbuf+o); o += strlen(cbuf)+1; }
Related topics
None.