[GRASSLIST:406] Re: G_gisinit

Ana Soares tiobrothercamarada at gmail.com
Mon Mar 27 04:38:54 EST 2006


I'm sorry, but I still don't understand :( Can someone explain this to me ?

Thanks.

2006/3/24, Glynn Clements <glynn at gclements.plus.com>:
>
>
> Ana Soares wrote:
>
> >  int G_gisinit (char *program_name)initialize gis libraryThis routine
> reads
> > the user's GRASS environment file into memory and makes sure that the
> user
> > has selected a valid database and mapset. It also initializes hidden
> > variables used by other routines. If the user's database information is
> > invalid, an error message is printed and the module exits. The
> *program_name
> > * is stored for later recall by *G_program_name.* It is recommended that
> > argv[0] be used for the *program_name
> > *
> >
> > *Ok.
> > *
> >
> > *So I use it  in my program, like :
> > *
> >
> > * int main(int argc, char **argv) {
> >
> >    G_gisinit(argv[0]) ;
> > }
> >
> > *
> >
> > And the program just stands there :-S
> >
> > I'm really confused! After all, what does this function do ?
>
> It checks that the GRASS environment is set up correctly, and
> initialises some important variables.
>
> > How am I supposed to use it?
>
> Like the above. Then you need to use G_define_{module,flag,option}
> followed by G_parser(). What happens after that depends upon your
> program, but all GRASS modules start with a common framework involving
> G_gisinit() and G_parser().
>
> Look at doc/raster/r.example or doc/vector/v.example for examples of
> how to write GRASS modules.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20060327/844d0903/attachment.html


More information about the grass-user mailing list