1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
# slow5_get_hdr_keys
## NAME
slow5_get_hdr_keys - gets the list of data header attribute keys
## SYNOPSYS
`const char **slow5_get_hdr_keys(const slow5_hdr_t *header, uint64_t *len)`
## DESCRIPTION
`slow5_get_hdr_keys()` gets the list of data header attribute keys from a SLOW5 file header pointed by *header*. The number of attribute keys will be set on the address specified by *len*.
## RETURN VALUE
`slow5_get_hdr_keys()` returns the list of attribute keys as a *char*** pointer. If there are no header attributes, NULL is returned. The retuned pointer must be freed by user.
## ERRORS
TODO
## NOTES
Only the returned *char*** pointer must be freed and not the the actual key labels (char *) which are from an internal data structure.
## EXAMPLES
```
#include <stdio.h>
#include <stdlib.h>
#include <slow5/slow5.h>
#define FILE_PATH "examples/example.slow5"
int main(){
slow5_file_t *sp = slow5_open(FILE_PATH,"r");
if(sp==NULL){
fprintf(stderr,"Error in opening file\n");
exit(EXIT_FAILURE);
}
uint64_t num_keys = 0;
const char **keys = slow5_get_hdr_keys(sp->header, &num_keys);
if(keys==NULL){
fprintf(stderr,"Error in getting header keys\n");
exit(EXIT_FAILURE);
}
for(int i=0; i<num_keys; i++) {
printf("%s\n",keys[i]);
}
free(keys);
slow5_close(sp);
}
```
## SEE ALSO
[slow5_yy()](slow5_yy.md), [slow5_yy()](slow5_yy.md)
|