<div dir="ltr"><div>Hi,</div><div><br></div><div>there is a binary file I would like to extract some info from.</div><div><br></div><div>If one opens the file witha text editor (such as notepad) it turns out, that some human readable parts are inside of the binary file.</div><div><br></div><div><br></div><div>With Scilab I can get these data parts by:</div><div><br></div><div><pre style="font-family:Monospaced;font-style:normal"><span style="color:rgb(0,0,0)">fd</span>  <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(50,185,185)">mopen</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">files</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(188,143,143)">r</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span>            <span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)"><span style="color:rgb(100,174,100);font-style:italic">// with files(i) beeing a list of absolute file paths</span></span></span>
    <span style="color:rgb(0,0,0)">data</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(50,185,185)">mfscanf</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(0,0,0)">fd</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(188,143,143)">'</span><span style="color:rgb(188,143,143)">%c</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span> 
<span style="color:rgb(50,185,185)">mclose</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">fd</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;<br><span style="color:rgb(0,0,0)">txt</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(50,185,185)">strcat</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">data</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;                       <span style="color:rgb(100,174,100);font-style:italic">// is the complete file in one single line</span><br></span></span></pre><pre style="font-family:Monospaced;font-style:normal"><span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)"><br><span style="font-family:arial,sans-serif">Now I can do some regexp-search within the txt.<br><br></span></span></span></pre><pre style="font-style:normal"><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">Question:<br></span></span></span></pre><pre style="font-style:normal"><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">Since the file an become quite big and since the data of interest are more to the end of the file,<br></span></span></span></pre><pre style="font-family:Monospaced;font-style:normal"><span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)"><span style="font-family:arial,sans-serif">the step:    </span>
<span style="color:rgb(0,0,0)">   <br>data</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(50,185,185)">mfscanf</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(0,0,0)">fd</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(188,143,143)">'</span><span style="color:rgb(188,143,143)">%c</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span>
<br></span></span></pre><pre style="font-style:normal"><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">can take very long.<br><br></span></span></span></pre><pre style="font-style:normal"><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">I tried <br><br>data =  mgetl (fd, -1);<br><br>which is much faster, but does not return the correct characters / string.<br></span></span></span></pre><pre style="font-style:normal"><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)"><br></span></span></span></pre><pre style="font-style:normal"><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">Any idea for exchanging the mfscanf-command?<br><br></span></span></span></pre><pre style="font-style:normal"><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">Thank you,<br></span></span></span></pre><pre style="font-family:Monospaced;font-style:normal"><span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)"><span style="font-family:arial,sans-serif">Philipp</span><br></span></span></pre><pre style="font-family:Monospaced;font-style:normal"><span style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)"><br> <br></span></span></pre></div></div>