title: Delphi - Array of Ansichar to String and Vice versa
body: <p>I have been given an SDK which takes a fingerprint template from a device, i need to store this in a SQL database and then reload to the FP device.</p>
  
  <p>The SDK FP template data is defined as <code>template_data:array[0..1568] of ansichar;</code>.</p>
  
  <p>The template is stored in database ok by converting the template data to a string using code below:</p>
  
  <pre><code>SetString(s, user.template_data[i].template_data, 
            user.template_data[i].template_length);
  </code></pre>
  
  <p>The problem comes when converting the string back from the database to the template data, it only copies the first 3 characters when using <code>StrLCopy</code></p>
  
  <pre><code>StrLCopy(PChar(@user.template_data[0].template_data),
           PChar(s), FieldByName('FPLen').AsInteger);
  </code></pre>
  
  <p>When debugging the code i notice that there 4 character in the template is a null character so i guess that's why only the first 3 are copied.</p>
  
  <p>Need a solution to copy the string with the null characters to an array of ansichar.</p>