title: C: Sending a RPC Method name + Arguments
body: <p>I'm looking to send an RPC, in this case a char array containing the name of the function to execute and the list of arguments.</p>
  
  <p>Arguments are ints.</p>
  
  <p>Example:</p>
  
  <pre><code>Function name: plus
  argument 1: 19
  argument 2: 23
  </code></pre>
  
  <p>What I'm thinking to do, is to construct an array containing each of these, in order:</p>
  
  <ol>
  <li>the octal value of the size of function name (in this example, 4)</li>
  <li>the chars <code>'p', 'l', 'u', 's'</code></li>
  <li>the octal value of the size of first argument (in this case, 2, because '1', '9')</li>
  <li>the char '1' and the char '9'</li>
  <li>the octal value of the size of second argument (in this case 2, because '2', '3')</li>
  <li>the char '2' and the char '3'</li>
  </ol>
  
  <p>Then, I need to compact</p>
  
  <p>I already have this function that encodes to octal value:</p>
  
  <pre><code>int decimalToOctal(int n) {
    int rem, i = 1, octal = 0;
    while (n != 0) {
      rem = n % 8;
      n/=8;
      octal += rem*i;
      i *= 10;
    }
  
    return octal;
  }
  </code></pre>
  
  <p>But I have no idea how to compact the octal values and chars into one single array that I'll need to send through socket. Or may be will I need another type of array? Thanks for any hint.</p>