-------------pictoPdf.sh--------------
#!/bin/bash
cd /home/kris/catkin_ws/src/imgpclconvert 1.jpg 1.pdf
exit 0
--------imgpcl_sample.cpp-------
#include <stdlib.h>
int system(const char *string);
int main(){
system("/home/kris/catkin_ws/src/imgpcl/pictoPdf.sh");
return 0;
}
ps:
do not forget " chmod +x *.sh"
reference:
https://baozh.github.io/2013-11/how-to-call-shell-script-in-c-plus-plus-program/
http://blog.csdn.net/ddkxddkx/article/details/7019408
http://blog.csdn.net/yangruibao/article/details/7255787