title: strncpy introduces funny character
body: <p>When I run some code on my machine then it behaves as I expect it to.</p>
  
  <p>When I run it on a colleagues it misbehaves. This is what happens.</p>
  
  <p>I have a string with a value of:</p>
  
  <blockquote>
    <p>croc_data_0001.idx</p>
  </blockquote>
  
  <p>when I do a <code>strncpy</code> on the string providing 18 as the length my copied string has a value of:</p>
  
  <blockquote>
    <p>croc_data_0001.idx♂</p>
  </blockquote>
  
  <p>If I do the following </p>
  
  <pre><code>myCopiedString[18]='\0';
  puts (myCopiedString);
  </code></pre>
  
  <p>Then the value of the copied string is:</p>
  
  <blockquote>
    <p>croc_data_0001.idx</p>
  </blockquote>
  
  <p>What could be causing this problem and why does it get resolved by setting the last char to <code>\0</code>?</p>