c++ - Segmentation fault issue -


i trying make system() command move mouse using xdotool.

the following test program:

int main() {      int x = 10;     int y = 50;      char* str;      sprintf(str, "xdotool mousemove %d, %d", x, y);     system(str); } 

i getting segmentation fault (core dumped) error. there way know of allow such command work? i've tried root way. i'm new c++ , appreciated.

the other answers correct however, can use better methods in c++ rather using sprintf

int main() {     int x = 10;    int y = 50;     std::stringstream ss;    ss <<  "xdotool mousemove " << x << " " << y;    system(ss.str().c_str()); } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -