Sending C array on ROS using messages
<p>My ROS message is simple:</p>

<pre><code>int8[64] packet1
</code></pre>

<p>I am publishing in my talking node with:</p>

<pre><code>terp::Packet1 msg;
msg.packet1={0,1,0,1,0,1};
ROS_INFO("Packet in string form: %s", msg-&gt;packet1);
chatter_pub.publish(msg);
ros::spinOnce();
</code></pre>

<p>I am retrieving in my listening node with:</p>

<pre><code>void resolve_input1(const uint8_t msg[]) {
  if (sizeof(msg-&gt;packet1)/sizeof(msg-&gt;packet1[0])&lt;MAX_MSG_LEN) {
    memcpy(msg1,msg-&gt;packet1);
    ROS_INFO("I heard: [%s]\n",msg1);
  } else
    ROS_ERROR("Message from node 1 too long");
}
</code></pre>

<p>However, upon making the project, I receive the following error:</p>

<pre><code>listener.cpp:16:19: error: request for member 'packet1' in '*msg',
which is of non-class type 'const uint8_t {aka const unsigned char}
  if (sizeof(msg-&gt;packet1)/sizeof(msg-&gt;packet1[0])&lt;MAX_MSG_LEN) {
</code></pre>

<p>Changed resolve_input1's declaration to:</p>

<pre><code>void resolve_input1(const terp::Packet1 msg) {
</code></pre>

<p>EDIT:
Got rid of that error, but now a new one appears, which is similar; underlining my confusion about messages:</p>

<pre><code>listener.cpp:16:17 error: base operand of '-&gt;' has non-pointer type
'const Packet1 {aka const terp::Packet1_&lt;std::allocator&lt;void&gt; &gt;}'
    if (sizeof(msg-&gt;packet1)/sizeof(msg-&gt;packet1[0])&lt;MAX_MSG_LEN) {
                  ^
</code></pre>