tbeu / matio

MATLAB MAT File I/O Library
https://matio.sourceforge.io
BSD 2-Clause "Simplified" License
330 stars 97 forks source link

mat_t could expose the "header" field #111

Closed rafal-c closed 5 years ago

rafal-c commented 5 years ago

Suggestion: mat_t contains a header field where the file header is stored. However, there is no API function to access this field and the definition of mat_t is private. I know we can read file version from the header with Mat_GetVersion but the header may carry other information as well.

I believe it wouldn't hurt to add a simple API function like this

const char *Mat_GetHeader(mat_t *mat) {
    const char *header = NULL;
    if ( NULL != mat )
        header = mat->header;
    return header;
}

Possibly byteswap field could also be exposed in a similar manner.

tbeu commented 5 years ago

8189879cb5cf147b1e19ccb1feb8ad51e27c5a9d adds Mat_GetHeader.

The byteswap flag is of less relevance, since Mat_VarRead/Mat_VarWrite will consider it correctly.