home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!emory!emory!not-for-mail
- From: dave.snyder@snide.com (Dave Snyder)
- Newsgroups: comp.databases.informix
- Subject: Re: Catching output from RUN command (4GL)
- Date: 24 Jan 1993 22:13:03 -0500
- Organization: Mailing List Gateway
- Lines: 36
- Sender: walt@mathcs.emory.edu
- Distribution: world
- Message-ID: <1jvlrvINN9n@emory.mathcs.emory.edu>
- Reply-To: dave.snyder@snide.com (Dave Snyder)
- NNTP-Posting-Host: emory.mathcs.emory.edu
- X-Informix-List-ID: <list.1816>
-
- Quoting Paul Roberts...
- }
- } In article <C1D1pp.AA0@dircon.co.uk> uaa1006@dircon.co.uk (Peter Miles) writes:
- } >
- } >Does anyone know if there is any way of capturing the output
- } >of a command run by the 4GL RUN command into an Informix 4GL
- } >variable?
- } >
- }
- } You can always do something (kind of klugey!) like this :
- }
- [ Interesting kludge deleted... ]
-
- If you want to stay with pure 4GL, Paul's idea is perfect. If you aren't
- afraid of C, you could do something like this:
-
- Mind you, this pseudo code (but you'll get the idea)
-
- runit(arg)
- {
- FILE *pp;
- char buf[513], txt[257];
-
- popquote(buf, sizeof(buf)); /* Pop the run string off the stack */
- pp = popen(buf, "r"); /* Open a pipe for read w/ run string */
- fgets(txt, sizeof(txt), pp); /* Read a line from the pipe */
- pclose(pp); /* Close the pipe */
- retquote(txt); /* Push the txt string onto the stack */
- return(1); /* Tell 4GL that you returned 1 arg */
- }
-
- DAS
- --
- David Snyder @ Snide Computer Services - Folcroft, PA Current Release
- is db4glgen-3.9
- UUCP: ..!uunet!das13!dave INTERNET: dave.snyder@snide.com
-