<p>But <code>read(buffer, length)</code> should fill the buffer with up to <code>length</code> characters, terminated with a <code>\0</code> (like typical C strings).  Is it instead reading the CR (ASCII value 13) into the buffer?  The rule that causes <code>guess_file_type()</code> to return <code>arma_binary</code> is below:</p>

<pre><code>      // the range checking can be made more elaborate
      if( ((val_i &lt;= 8) || (val_i &gt;= 123)) || ((val_j &lt;= 8) || (val_j &gt;= 123)) )
        {
        has_binary = true;
        break;
        }
</code></pre>

<p>It sounds like maybe Conrad's comment applies here---we might simply need to make the rules more complex for Windows systems.</p>

<p>I don't have a Windows environment currently set up, so if you can help debug and test this, we can throw together a patch and send it upstream.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/468#issuecomment-155618186">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFEvo1j86fuaCiJN5A2obCg3IIwrHks5pEopWgaJpZM4Gd7SI.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/468#issuecomment-155618186"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>