<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Thanks a lot,
<br>Now everythings works!
<br>I had done in that way becouse i thougth i had segmantation falult
caused by <i>struct Colors *colr</i> while the problem was a pointer conflict
with a <i>char *.</i>
<br>I had a question about programming in GRASS:
<p>how can be done a debug of GRASS command in linux environment like is
done for generic C programs?
<br>I try Anjuta but I can only compile the command and cannot build it...
and so cannot debug....
<p>Thanks for your precious support.
<br>Massimiliano
<p>Glynn Clements wrote:
<blockquote TYPE=CITE>Massimiliano Cannata wrote:
<p>> I have a problem setting the color in a raster
<br>> map,
<br>> in my C file i call:
<br>>
<br>> .......
<br>> ......
<br>> char *name,*result, *mapset;
<br>> struct Colors *colr;
<br>>
<br>> name = input->answer;
<br>> result = output->answer;
<br>> mapset = G_find_cell2(name,"");
<br>>
<br>> G_init_colors(colr);
<p>"colr" is pointing at a random memory location. Change your code to:
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct Colors colr;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_init_colors(&amp;colr);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_add_color_rule((CELL)-50,
0,0,255, (CELL)0, 255,255,255, &amp;colr);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_add_color_rule((CELL)0,
255,255,255, (CELL)50, 255,0,0, &amp;colr);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_write_colors(result,mapset,&amp;colr);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_free_colors(&amp;colr);
<p>This applies in most situations where a function accepts a pointer as
<br>an argument; not just in GRASS, but in C generally.
<p>--
<br>Glynn Clements &lt;glynn.clements@virgin.net></blockquote>
</html>