[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] How to get stdout into gforth

From: carl hansen
Subject: Re: [gforth] How to get stdout into gforth
Date: Thu, 25 Jan 2018 23:54:10 -0800

On Thu, Jan 25, 2018 at 2:49 PM, Dennis Ruffer <address@hidden> 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?


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


Is that the right path, or is there another?




​here's one idea: write to a file ie "pwd >foo"
then read back the file, as so:

​#! /usr/bin/env gforth

s" foo" r/w create-file

drop  \ really should check for errors

variable fileid
fileid !

s" echo You think this works\?  >foo ; pwd >>foo " system

create filecontents 200 allot
filecontents 200 fileid @ read-file

filecontents 200 type
filecontents 100 dump

fileid @ close-file


​There probably is a way to do it with pipes, but it is beyond me.​

reply via email to

[Prev in Thread] Current Thread [Next in Thread]