[GRASS-dev] Call Grass modules from C++ code

Rashad M mohammedrashadkm at gmail.com
Mon Feb 18 08:33:12 PST 2013


Hi,

GRASS modules are independent process running in the system. you can use
stdout,stderr redirect using boost process or any other std stream redirect
library. This way you can read from grass modules and parse the output.

Hope that helps


On Mon, Feb 18, 2013 at 7:01 PM, matteo poletti <pollo1_91 at yahoo.it> wrote:

> Hi,
>
> I've already posted this question in the User mailing list but maybe, as
> suggested by somebody, it should be posted here...
>
> The problem is how to call a Grass module from my code written in C++.
>
> I have already received some answers:
>
> 1 - Do a sys-call
>
> I would avoid this approach if possible. It is not very reliable and it
> requires to parse the output of the modules as strings.
>
> 2 - Use the keyword extern to call the GRASS library functionalities (
> http://grasswiki.osgeo.org/wiki/GRASS_and_C++)
>
> I have not understood if this approach is suitable also to call GRASS
> modules. If it is, can you please suggest me an example of this?
>
> Thank you for your help! And sorry for having posted this twice.
> Matteo
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>



-- 
Regards,
   Rashad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20130218/bbed6e77/attachment.html>


More information about the grass-dev mailing list