Ask Your Question
1

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

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

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

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
0

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

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

int main(int argc,char ** argv){
    printf("s%",argv[0]);
    return 0;
}
edit flag offensive delete link more

Comments

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 imageNEngelhard ( 2015-08-19 06:31:35 -0600 )edit

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

cyborg-x1 gravatar imagecyborg-x1 ( 2015-08-19 08:02:12 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 323 times

Last updated: Aug 19 '15