#include "SSTable.h"
int SSTable::GetColumnIndex(const char * columnName);
#include <string.h>
#include <stdlib.h>
#include "SSTable.h"
extern char ** ConvertRVCACifString(ReVarCifArray<CifString>*);
SSTable * pTable = new SSTable("MyTable");
... // add some columns and stuff
ReVarCifArray<CifString> * cifarray = pTable->GetColumnNames();
char ** colNames = ConvertRVCACifString(cifarray);
// sort the names
qsort(colNames, pTable->GetNumColumns(), sizeof(char *), strcmp);
// do something to each column, alphabetically
for (int i = 0; i < pTable->GetNumColumns(); i++) {
int index = pTable->GetColumnIndex(colNames[i]);
...
}
GetColumnIndex returns the index of the column with the given name.
| columnName | The name of the column. |
An integer representing the position of the column in the table. For example, an index of 0 represents the 1st column.
A negative value means that an error has occured, i.e. the column with the specified name was not found in the table.
| None |