[sane-devel] Programming getting a SIGSEGV

Mohit Kumar Mohit Kumar <mohit.kumar@gmail.com>
Mon, 20 Jun 2005 17:16:17 +0530


Hi All,

I have the following piece of code: (kindly ignore the declarations..)

options =3D sane_get_option_descriptor(handle, index); //index points to
mode option
int j=3D0;
if(options!=3DNULL)
{
     while(options->constraint.string_list[j])
    {
           if(strcmp(options->constraint.string_list[j] =3D=3D "Grayscale"
           {
                 SANE_Status status =3D
sane_control_option(handle,index,SANE_ACTION_SET_VALUE,(SANE_String*)"Grays=
cale",0);
                .
                .
                .
                .=20
           }
           else
           //now for color

           j++;
    }
}

Now j=3D0 return Lineart, j=3D1 returns Halftone, j=3D2 returns Grayscale.
But for j=3D3 (it should have returned "Color"), program crashes and it
says cannot access memory at address 0x25.

I have a HP ScanJet 6200C/6250C and I have verified it has all the four mod=
es.=20

Am i doing something wrong? I cannot understand why the fourth value
is giving me problems while the first three have gone correct?

Thanks,
Mohit