MemCom Reference Manual > MemCom C API Manual Pages > Sparse Table Functions > mcSTcellGetCopy

Name

mcSTcellGetCopy — Get a pointer to buffer containing a copy of the data of a sparse-table cell

Synopsis

#include <memcom.h>

void* mcSTcellGetCopy(int dsid, int row_index, mcInt64 column_index);

Description

mcSTcellGetCopy returns, for the sparse-table dataset identified by dsid, a pointer to a newly allocated buffer containing a copy of the data of the cell identified by the row row_index and the column index column_index. If the cell is empty, NULL is returned.

In contrast to the pointers returned by mcSTcellGet, applications may modify the buffers contents, and the buffer remains valid until it is freed by the application, using mcDBfree.

Parameters

dsid (input)

Dataset identifier.

row_index (input)

Index of the row, starting at 1.

column_index (input)

Index of the column whose data is requested. Column indices start at 1.

Return Value

If no error occurred and the cell is not empty, a pointer to a newly-allocated buffer containing a copy of the cell data is returned. The data type of the elements in the buffer can be obtained by calling mcSTcolAttributes. The number of data elements in the buffer can be obtained by calling mcSTcellNumElements, and for fixed-size columns also by calling mcSTcolAttributes. The length of the buffer in bytes can be determined by calling mcSTcellSize.

For columns of type "K" (character strings), the data in the buffer whose pointer is returned, is terminated by a NUL-character. The string length is always smaller than the number of data elements and the number of bytes of the cell buffer.

Applications must free the buffer after use with mcDBfree.

If no error occurred and the cell is empty, NULL is returned.

In case of errors (because of an invalid dsid, row_index, or column_index argument), NULL is also returned, and the MemCom error number can be obtained by calling mcErrStatus.

See Also

mcSTcellGet

mcSTcellGetArray

mcSTcellNumElements

mcSTcellSet

mcSTcellSetK

mcSTcellSize