[sane-devel] Programming getting a SIGSEGV

Mohit Kumar Mohit Kumar <mohit.kumar@gmail.com>
Mon, 20 Jun 2005 19:27:39 +0530


Sorry for the confusion Allan. But no its not the case. Rather it is
the following:

   else
   {
             //now for color       =20
    }
    j++;

Thanks,
Mohit

On 6/20/05, m. allan noah <anoah@pfeiffer.edu> wrote:
>=20
> mohit, perhaps you mean
>=20
> else {
>            //now for color
>=20
>            j++;
> }
>=20
> note the braces.
>=20
> allan
>=20
> On Mon, 20 Jun 2005, Mohit Kumar wrote:
>=20
> > Hi All,
> >
> > I have the following piece of code: (kindly ignore the declarations..)
> >
> > options =3D sane_get_option_descriptor(handle, index); //index points t=
o
> > mode option
> > int j=3D0;
> > if(options!=3DNULL)
> > {
> >     while(options->constraint.string_list[j])
> >    {
> >           if(strcmp(options->constraint.string_list[j] =3D=3D "Grayscal=
e"
> >           {
> >                 SANE_Status status =3D
> > sane_control_option(handle,index,SANE_ACTION_SET_VALUE,(SANE_String*)"G=
rayscale",0);
> >                .
> >                .
> >                .
> >                .
> >           }
> >           else
> >           //now for color
> >
> >           j++;
> >    }
> > }
> >
> > Now j=3D0 return Lineart, j=3D1 returns Halftone, j=3D2 returns Graysca=
le.
> > 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=
 modes.
> >
> > 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
> >
> > --
> > sane-devel mailing list: sane-devel@lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/sane-devel
> > Unsubscribe: Send mail with subject "unsubscribe your_password"
> >             to sane-devel-request@lists.alioth.debian.org
> >
>=20
> --
> "so don't tell us it can't be done, putting down what you don't know.
> money isn't our god, integrity will free our souls" - Max Cavalera
>