<br>Hi Thomas, <br>it worked nicely, <br><br>thank you very much!<br><div class="gmail_quote">2009/7/28 thomas fossati <span dir="ltr">&lt;<a href="mailto:tho@koanlogic.com">tho@koanlogic.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><div>Hi Moises,</div><div><div class="im"><div><br></div><div>On Jul 28, 2009, at 7:54 PM, moises acuna wrote:</div></div><blockquote type="cite"><div class="im">Hello all,<br>my problem is this, my embedded web application generates binary files and the user is capable to download them. I&#39;m doing it like this:<br>
</div>[SNIP]<div class="im"><br>Expecting for comments and thanks in advanced. <br></div></blockquote><div><font color="#144fae"><br></font></div></div><div>the following POC kl1 hopefully does what you need:</div><div><br>
</div><div><div>&lt;%!</div><div>    #include &lt;u/libu.h&gt;</div><div><br></div><div>    #define TEST_FN &quot;/tmp/test&quot;</div><div>%&gt;&lt;%</div><div>    size_t rb;</div><div>    char buf[1024];</div><div>    FILE *target = NULL;</div>
<div><br></div><div>    target = fopen(TEST_FN, &quot;r&quot;);</div><div>    warn_err_sifm (target == NULL, &quot;%s&quot;, TEST_FN);</div><div><br></div><div>    while ((rb = fread(buf, 1, sizeof buf, target)) != 0)</div>
<div>        (void) io_write(out, buf, rb);</div><div><br></div><div>    warn_if (!feof(target) &amp;&amp; ferror(target));</div><div><br></div><div>    // fall through</div><div>err:</div><div>    if (target)</div><div>        fclose(target);</div>
<div>    return;</div><div>%&gt;</div><div><br></div><div>ciao, t.</div></div><br><div><div><div>PS: the &#39;0xA 0xD&#39; stuff gets in because you probably don&#39;t stick &#39;%&gt;&lt;%&#39; together: the  kl1 parser interprets the new line literally which is clearly not what you want when pushing raw files.</div>
<div><br></div><div>PS2: try to avoid &quot;read&quot; as a variable name as it&#39;s already taken by the syscall.</div></div></div></div><br>_______________________________________________<br>
Klone-users mailing list<br>
<a href="mailto:Klone-users@koanlogic.com">Klone-users@koanlogic.com</a><br>
<a href="http://koanlogic.com/cgi-bin/mailman/listinfo/klone-users" target="_blank">http://koanlogic.com/cgi-bin/mailman/listinfo/klone-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Moisés AAC<br>