[GRASS5] howto: direct access to raster cells - skeletons in cvs?

I want to perform the following task:
  1) read a single cell in a raster map
  2) modify its value
  3) write it back and display the map

When having a look at r.example using KDevelop, I received
  module = G_define_module();
  -> warning: assignment makes pointer from integer without a cast
and
  module->description ="GRASS raster programming example.";
  -> error: dereferencing pointer to incomplete type
so I got both stuck and very nervous... ;-))

It would be very helpful if there were some basic skeletons ( r.user, v.user ...) prepared in the cvs for home-brewed functions which do compile clean and are showing the correct use of the given basic resources.

Mit freundlichen Grüßen / With kindest regards

Stefan Paulick

stefan.paulick@urbeli.com
http://www.urbeli.com
/*----------------------*/

I want to perform the following task:
  1) read a single cell in a raster map
  2) modify its value
  3) write it back and display the map

Have a look at the C code for r.univar.

I don't guarantee it is "correct" enough to be put forward as an
official example, but it does work and is not that complicated.

http://freegis.org/cgi-bin/viewcvs.cgi/grass/src/raster/r.univar2/main.c?rev=1.7&content-type=text/vnd.viewcvs-markup

Hamish

Stefan Paulick wrote:

I want to perform the following task:
  1) read a single cell in a raster map
  2) modify its value
  3) write it back and display the map

When having a look at r.example using KDevelop, I received
  module = G_define_module();
  -> warning: assignment makes pointer from integer without a cast
and
  module->description ="GRASS raster programming example.";
  -> error: dereferencing pointer to incomplete type

Those messages suggest that your GRASS headers are from an extremely
old version of GRASS 5. "struct GModule" and G_define_module were
added on 2000/11/21. GRASS 4.x didn't support FP, so you would have a
lot more errors if you were trying to use 4.x headers.

r.example compiles fine with a current version of GRASS.

--
Glynn Clements <glynn.clements@virgin.net>