Re: How to get stdout into gforth

Anton Ertl <anton-8NJIiSa5LzB3ZGU3T6kWFyEcasqEdqbRs2V0tQ3P5b8@public.gmane.org>
Newsgroups gmane.comp.lang.forth.gforth
Message-ID <[email protected]>
On Thu, Jan 25, 2018 at 02:49:02PM -0800, Dennis Ruffer wrote:
> Say I want to do something like this: 
> 
> s" cd .. ; pwd" system /home/druffer
> 
> How do I get the output of pwd back into gforth?

You would use OPEN-PIPE instead of SYSTEM, but I don't have an example.

> I see infile-execute, but I don’t see an examples for me to try.

INFILE-EXECUTE is for making any file temporarily the standard input
(so that KEY reads from this file).  But for your problem, you need to
get the output of pwd into gforth.  A pipe does that.

> Is that the right path, or is there another?

You could use the C interface to call chdir(), getcwd(), and then
somehow chdir() back.

- anton
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.