Reputation: 4199
I'm trying to execute a graphviz/dot cmd from within my program,
but I'm still getting the error sh: dot: command not found
.
So that's the line that matters:
system("dot -Tpng myfile.txt -o mypic.png");
Executing it on the terminal works pretty well, cause dot is set into my path variable. Trying to execute the same programmatically ends up in the described error.
Is there any trick using the system cmd where I have to mention my path additionally?
(Btw: I already did include stdlib.h, dunno wether that's important...)
Thx a lot!
Upvotes: 3
Views: 147
Reputation: 35458
You can try something like this:
#include <stdlib.h>
int main()
{
system("PATH=$PATH:<YOUR PATH TO **dot**>;<**dot** and the rest>");
}
as shocking as it seems, this works for me ... (obviously replace between < > ... )
Upvotes: 1