modified: src1/input.c
[GalaxyCodeBases.git] / c_cpp / lib / klib / test / kseq_test.c
blob0304dea35ed9fbb0e2f8c278ad792fd85a526f8f
1 #include <zlib.h>
2 #include <stdio.h>
3 #include "kseq.h"
4 KSEQ_INIT(gzFile, gzread)
6 int main(int argc, char *argv[])
8 gzFile fp;
9 kseq_t *seq;
10 int l;
11 if (argc == 1) {
12 fprintf(stderr, "Usage: %s <in.fasta>\n", argv[0]);
13 return 1;
15 fp = gzopen(argv[1], "r");
16 seq = kseq_init(fp);
17 while ((l = kseq_read(seq)) >= 0) {
18 printf("name: %s\n", seq->name.s);
19 if (seq->comment.l) printf("comment: %s\n", seq->comment.s);
20 printf("seq: %s\n", seq->seq.s);
21 if (seq->qual.l) printf("qual: %s\n", seq->qual.s);
23 printf("return value: %d\n", l);
24 kseq_destroy(seq);
25 gzclose(fp);
26 return 0;