Skip to the content.

slow5_open

NAME

slow5_open - opens a SLOW5 file

SYNOPSYS

slow5_file_t *slow5_open(const char *pathname, const char *mode)

DESCRIPTION

The slow_open() function opens a SLOW5 file (ASCII or binary) pointed by the argument pathname, parses and populates the SLOW5 header. slow_open() determines if the file is SLOW5 ASCII or SLOW5 Binary from extension of the argument pathname (.slow5 for SLOW5 ASCII and .blow5 for SLOW5 binary).

Currently, the argument mode points to a string which can be one of the following:

An open slow5 file should be closed at the end using slow5_close() function.

RETURN VALUE

Upon successful completion, slow_open() returns a slow5_file_t pointer. Otherwise, NULL is returned and slow5_errno is set to indicate the error.

ERRORS

NOTES

Internally uses fopen(). If mode is r, the stream is positioned at the beginning of the data records when slow_open() returns. If mode is w, the stream is positioned at the end of the file. If mode is a, the stream is positioned at the end of the file for .slow5; and 5 bytes before the end of the file for .blow5 such that the existing SLOW5 EOF marker is overwritten.

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_close(sp);

}

SEE ALSO

slow5_close()