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

Revision history [back]

msg->data is of type string and ur function input argument is of type char*. Therefore u cannot directly pass either msg->data or msg->data.c_str() as argument and since u cannot change ur function argument i suggest following. Add this to ur subscriber callback

char *c; c=new char[sizeof(msg->data)]; c=&what[0]; myfunction(c)

This should work.

PS.Let me know if this doesnt work or any of the assumptions i made regarding ur problem is wrong.