Ask Your Question
-1

how can i convert a char* into std_msgs::String [closed]

asked 2019-09-22 20:58:28 -0600

arifle gravatar image

Hello, std_msgs::String data1; char buffer[20];

I just want to do data1.something = buffer

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by kscottz
close date 2019-09-23 13:30:23.374358

Comments

Not related to ROS in any way. https://www.geeksforgeeks.org/how-to-...

billy gravatar imagebilly ( 2019-09-22 21:10:47 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-09-22 22:51:04 -0600

ahendrix gravatar image

The single member of std_msgs::String is a std::string named data. The normal conversions between char * and std::string apply (among others, the assignment operator works):

std_msgs::String message;
char buffer[20] = "Hello World";
message.data = buffer;
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-09-22 20:58:28 -0600

Seen: 30 times

Last updated: Sep 22