int QSget_rows (QSprob p, int **rowcnt, int **rowbeg, int **rowind,
    double **rowval, double **rhs, char **sense, char ***names)
/* p is an initialized QSprob, a handle to an existing LP problem  */

double *rowval = NULL, *rhs = NULL;
int *rowcnt = NULL, *rowbeg = NULL, *rowind = NULL;
char *sense = NULL, **names = NULL;
int nrows, i, j, rval;

nrows = QSget_rowcount (p);
rval = QSget_rows (p, &rowcnt, &rowbeg, &rowind, &rowval, &rhs, &sense,
                      &names);
if (rval) {
    fprintf (stderr, "could not obtain rows, error code %d\n", rval);
} else {
    for (i = 0; i < nrows; i++) {
        printf ("%s RHS = %f, SENSE = %c\n",
                names[i], rhs[i], sense[i]);
        printf ("   Coefficients: ");
        for (j = rowbeg[i]; j < rowbeg[i] + rowcnt[i]; j++) {
            printf ("(%d, %f) ", rowind[j], rowval[j]);
        }
        printf ("\n");
    }
}

QSfree (rowcnt); QSfree (rowbeg); QSfree (rowind); QSfree (rowval);
QSfree (rhs); QSfree (sense);
if (names) {
    for (i = 0; i < nrows; i++) {
        QSfree (names[i]);
    }
    QSfree (names);
}