Hi everyone,
I am trying to get the quality of the read from the bam file with the samtools c++ library.

I am using the following (partial) code:
Code:
bam1_t *b = bam_init1();
...
while(samread(reads, b) >=0){

uint8_t *readQual = bam1_qual(b);
...

cout<<"quality:"<<endl;
for(int k=0;k<readLength;k++){
            cout<<readQual[k]<< " ";
}
cout<<endl;

}
but I am not getting correct values for the read quality.

Does anyone have any suggestion on what I am doing wrong?

Thanks in advance!