On Fri, Oct 30, 2020 at 7:25 AM Kacper Gutowski <mwgam...@gmail.com> wrote:

> On Thu, Oct 29, 2020 at 10:22:52PM +0100, Hans-Peter Sorge wrote:
> >the return size from ⎕FIO[24] / ⎕FIO[6] is limited to 5000B:
> (...)
> >Should be: What ever it takes :-)
>
> It's not limited to 5000B, it's just the default size and you can use
> any other with dyadic form.  ⎕FIO is fairly low-level and has very few
> convenience wrappers like ⎕FIO[26].  Perhaps one doing popen and reading
> the whole output like Perl's `` would be in order too, but it definitely
> shouldn't be what ⎕FIO[6] does.
>
> You can relatively easily do something like this:
>
>      ∇ bytes←read_to_eof fd ;buf
> [1]   bytes←0⍴0
> [2]  loop:
> [3]  →(⎕FIO['feof'] fd)/0
> [4]   buf←⎕FIO['fread'] fd
> [5]  →(0≡buf)/loop
> [6]   ⎕ES(1≠⍴⍴buf)/⎕FIO['strerror'] buf
> [7]   bytes←bytes,buf
> [8]  →loop
>      ∇
>
> (It could be a one-liner if API were designed a bit better,
> but it's still workable.)
>

I'd like to see your API design proposal.

Thanks!

Blake

Reply via email to