ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to get the executable path of a node with C++?

asked 2015-08-18 10:13:53 -0500

updated 2015-08-18 10:14:53 -0500

Is there an easy way to get the whole path for a executable in a package with C++? like getPath for the package path? (ros/package.h)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-19 05:58:53 -0500

In the main fonction,the argv[0] is the executable path, you can theck it as below:

int main(int argc,char ** argv){
    return 0;
edit flag offensive delete link more


I guess he rather wants to know where an executable for a specific package is. (A program in package A wants to find out where a specific program in package B is located)

NEngelhard gravatar image NEngelhard  ( 2015-08-19 06:31:35 -0500 )edit

@FooBar Correct. I want it to start it with my program.

cyborg-x1 gravatar image cyborg-x1  ( 2015-08-19 08:02:12 -0500 )edit

Question Tools



Asked: 2015-08-18 10:13:53 -0500

Seen: 571 times

Last updated: Aug 19 '15