<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 11/12/2019 à 14:31, Chin Luh Tan a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:16ef527f574.12799511f225859.7570712554584492025@bytecode-asia.com">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<div style="font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10pt;">
<div>Hi,<br>
</div>
<div><br>
</div>
<div>I am trying to print some progress of a for loop in C api
which will print the output in scilab console using the
sciprint.<br>
</div>
<div><br>
</div>
<div>Is there anyway to print the output to a same line as
normal C printf could be achieved using '\r' ? <br>
</div>
<div><br>
</div>
<div>e.g.:<br>
</div>
<div><br>
</div>
<div>currently my out out showing:<br>
</div>
<div><br>
</div>
<div>Train Epoch: 10 [ 1000/15416] Loss: 0.5961 <br>
</div>
<div>Train Epoch: 10 [ 2000/15416] Loss: 0.6794<br>
</div>
<div>Train Epoch: 10 [ 3000/15416] Loss: 0.3965<br>
</div>
<div>Train Epoch: 10 [ 4000/15416] Loss: 0.8110<br>
</div>
<div>Train Epoch: 10 [ 5000/15416] Loss: 0.7892<br>
</div>
<div><br>
</div>
<div>I would like to have the output to show on the same line. <br>
</div>
<div><br>
</div>
<div>I tried \r with fflush(stdout) it seems not working.<br>
</div>
<div><br>
</div>
<div>Thanks.<br>
</div>
<div><br>
</div>
<div>rgds,<br>
</div>
<div>Chin Luh</div>
</div>
</blockquote>
<p><br>
</p>
<p>In the C API i don't know, but in Scilab language, <a
moz-do-not-send="true"
href="http://bugzilla.scilab.org/show_bug.cgi?id=14642">this
mprintf("..\r") feature is broken</a>.</p>
<p>It is possible to mimik it with (example):<br>
</p>
<pre style="font-family:Monospaced;font-style:normal;font-size:14.0;"><span style="color:rgb(160,32,240);">for</span> <span style="color:rgb(0,0,0);">i</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">1</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(188,143,143);">100</span>
<span style="color:rgb(50,185,185);">mprintf</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">Static counter: %d\n \n\n</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">i</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(50,185,185);">sleep</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">300</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(50,185,185);">clc</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(160,32,240);">end
<font color="#000000">Samuel</font></span></pre>
<p><br>
</p>
</body>
</html>