XPRSgetnames
XPRSgetnames |
Purpose
Returns the names for the
rows,
columns or
set in a given range. The names will be returned in a character buffer, each name being separated by a null character.
Synopsis
int XPRS_CC XPRSgetnames(XPRSprob prob, int type, char names[], int first, int last);
Arguments
prob
|
The current problem.
|
||||||
type
|
|
||||||
names
|
Buffer long enough to hold the names. Since each name is
8*NAMELENGTH characters long (plus a null terminator), the array,
names, would be required to be at least as long as (
first-last+1)*(
8*NAMELENGTH+1) characters. The names of the row/column/set
first+i will be written into the
names buffer starting at position
i*8*NAMELENGTH+i.
|
||||||
first
|
First row, column or set in the range.
|
||||||
last
|
Last row, column or set in the range.
|
Example
The following example retrieves the row and column names of the current problem:
int cols, rows, nl; ... XPRSgetintattrib(prob,XPRS_COLS,&cols); XPRSgetintattrib(prob,XPRS_ROWS,&rows); XPRSgetintattrib(prob,XPRS_NAMELENGTH,&nl); cnames = (char *) malloc(sizeof(char)*(8*nl+1)*cols); rnames = (char *) malloc(sizeof(char)*(8*nl+1)*rows); XPRSgetnames(prob,1,rnames,0,rows-1); XPRSgetnames(prob,2,cnames,0,cols-1);
To display
names[i], use
int namelength; ... XPRSgetintattrib(prob,XPRS_NAMELENGTH,&namelength); printf("%s",names + i*(8*namelength+1));
Related topics