Populate Struct of Char Pointers
<p>Let's say you have this structure:</p>

<pre><code>struct MMFS_IDENTIFICATION
{
    char *szVendor;
    char *szControllerModel;
    char *szRevision;
    char *szId;
    char *szExecutive;
    char *szKarelRevision;
    char *szProcessName;
    char *szCommRevision;
    char *szRobotModel;
};
</code></pre>

<p>Is there any easy way to do something like this?</p>

<pre><code>MMFS_IDENTIFICATION mmfsId;

for( int i = 0; i &lt; 9; i++ )
{
    int len = buf[pos++];
    mmfsId[i] = malloc(len);
    memcpy( mmfsId[i], buf[pos], len );
    pos += len;
}
</code></pre>

<p>The only thing I know to do is copy and paste the code nine times. But I really don't want to do that because in the real program I'm using this concept for, calculating <strong>len</strong> is not as simple as I made it in this example. </p>
