File: slow5_rec_free.md

package info (click to toggle)
libslow5lib 0.7.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 25,084 kB
  • sloc: ansic: 11,825; python: 1,179; sh: 547; makefile: 90; cpp: 40
file content (54 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download | duplicates (2)
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
# slow5_rec_free

## NAME
slow5_rec_free - frees up a SLOW5 record from memory

## SYNOPSYS
`void slow5_rec_free(slow5_rec_t *read)`

## DESCRIPTION

The `slow5_rec_free()` function frees the memory of a *slow5_rec_t* structure pointed by *read*, which must have been returned by a previous call to `slow5_get_next()` or `slow5_get()`. Otherwise, or if *free(read)* has already been called before, undefined behaviour occurs.
If *read* is NULL, no operation is performed.

## RETURN VALUE

None


## 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);
    }
    slow5_rec_t *rec = NULL;
    int ret=0;

    ret = slow5_get_next(&rec,sp);
    if(ret<0){
        fprintf(stderr,"Error in slow5_get_next. Error code %d\n",ret);
        exit(EXIT_FAILURE);
    }

    slow5_rec_free(rec);

    slow5_close(sp);

}

```

## SEE ALSO

[slow5_get()](slow5_open.md), [slow5_get_next()](slow5_get_next.md)