title: Error parsing string in C " left operand must be l-value"
body: <p>I am faced with the need to pull out the information in a string of the format "blah.bleh.bloh" in ANSI C.  Normally I would use strok() to accomplish this, but since I am getting this string via strtok, and strtok is not thread-safe, I cannot use this option.</p>
  
  <p>I have written a function to manually parse the string.  Here is a snippit:</p>
  
  <pre><code>for(charIndex=0; charIndex &lt; (char)strlen(theString); charIndex++)
  {
      if(theString[charIndex] == '.')
      {
          theString[charIndex] = '\0';
          osi_string_copy_n(Info[currentInfoIndex], 1024, theString, charIndex + 1 );
          currentInfoIndex++;
          theString = &amp;theString[charIndex + 1];
      }
      charIndex++;
  }
  </code></pre>
  
  <p>As you can see, I try to find the first occurrence of '.' and make note of the index of the character.  Then I convert the '.' to a null char and copy the first string to an array.</p>
  
  <p>Then I want to change the pointer to start just after where the delimiter was found, essentially giving me a new shorter string.</p>
  
  <p>Unfortunately I am getting an error on the line:</p>
  
  <pre><code>theString = &amp;theString[charIndex + 1];
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>error C2106: '=' : left operand must be l-value
  </code></pre>
  
  <p>Why am I not allowed to move the pointer like this?  Is my method flawed?  Perhaps someone has a better idea for me to parse this string.</p>
  
  <p>EDIT:  In response to the comments, the declaration for theString is:</p>
  
  <pre><code>char theString[1024] = {0};
  </code></pre>
  
  <p>Also, I am guaranteed that theString will never be more than 1024 characters.</p>