[sane-devel] Programming getting a SIGSEGV
m. allan noah
anoah@pfeiffer.edu
Mon, 20 Jun 2005 09:17:28 -0400 (EDT)
mohit, perhaps you mean
else {
//now for color
j++;
}
note the braces.
allan
On Mon, 20 Jun 2005, Mohit Kumar wrote:
> Hi All,
>
> I have the following piece of code: (kindly ignore the declarations..)
>
> options = sane_get_option_descriptor(handle, index); //index points to
> mode option
> int j=0;
> if(options!=NULL)
> {
> while(options->constraint.string_list[j])
> {
> if(strcmp(options->constraint.string_list[j] == "Grayscale"
> {
> SANE_Status status =
> sane_control_option(handle,index,SANE_ACTION_SET_VALUE,(SANE_String*)"Grayscale",0);
> .
> .
> .
> .
> }
> else
> //now for color
>
> j++;
> }
> }
>
> Now j=0 return Lineart, j=1 returns Halftone, j=2 returns Grayscale.
> But for j=3 (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
>
--
"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