libapl apl_exec results displayed as ?

2022-07-24 Thread enztec


hello

What does libapl output?- the apl_exec function returns 0 to stdout but what is 
the actual display?

for example  apl_exec('⍳20')  what/where is the 1 to 20 displayed so it can be 
captured?

thanks



Re: libapl apl_exec results displayed as ?

2022-07-24 Thread Chris Moller

apl_exec() can output to both stdout and stderr.

I use:


std::stringstream outbuffer;
 std::streambuf *coutbuf = std::cout.rdbuf();
 std::cout.rdbuf(outbuffer.rdbuf());
 std::stringstream errbuffer;
 std::streambuf *cerrbuf = std::cerr.rdbuf();
 std::cerr.rdbuf(errbuffer.rdbuf());
 execerr = apl_exec (cmd.toStdString ().c_str ());
 std::cout.rdbuf(coutbuf);
 std::cerr.rdbuf(cerrbuf);
 outString = QString (outbuffer.str ().c_str ());
 errString = QString (errbuffer.str ().c_str ());

On 7/24/22 16:12, enz...@gmx.com wrote:

hello

What does libapl output?- the apl_exec function returns 0 to stdout but what is 
the actual display?

for example  apl_exec('⍳20')  what/where is the 1 to 20 displayed so it can be 
captured?

thanks





OpenPGP_0xDA6C0193083E.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: libapl apl_exec results displayed as ?

2022-07-24 Thread enztec
Hi

i can see you code is c++

I am working with libapl with fpc (freepascal) and i can capture stdout and 
stderr fine in fpc coding
but the only stdout i get from ap_exec is the 0

i have apl_exec as a function and tried with either of the following definitions

function apl_exec(p : pchar) : longint; cdecl; // gives good results displayed 
but stdout captures only 0

function apl_exec(p : pchar) : ansistring; cdecl; // gives nothing to screen 
with apl_exec nor any stdout





On Sun, 24 Jul 2022 17:16:10 -0400

Chris Moller  wrote:

> apl_exec() can output to both stdout and stderr.
>
> I use:
>
>
> std::stringstream outbuffer;
>   std::streambuf *coutbuf = std::cout.rdbuf();
>   std::cout.rdbuf(outbuffer.rdbuf());
>   std::stringstream errbuffer;
>   std::streambuf *cerrbuf = std::cerr.rdbuf();
>   std::cerr.rdbuf(errbuffer.rdbuf());
>   execerr = apl_exec (cmd.toStdString ().c_str ());
>   std::cout.rdbuf(coutbuf);
>   std::cerr.rdbuf(cerrbuf);
>   outString = QString (outbuffer.str ().c_str ());
>   errString = QString (errbuffer.str ().c_str ());
>
> On 7/24/22 16:12, enz...@gmx.com wrote:
> > hello
> >
> > What does libapl output?- the apl_exec function returns 0 to stdout but 
> > what is the actual display?
> >
> > for example  apl_exec('⍳20')  what/where is the 1 to 20 displayed so it can 
> > be captured?
> >
> > thanks
> >
>