Path: utzoo!attcan!uunet!munnari.oz.au!brolga!bunyip.cc.uq.oz.au!marlin.jcu.edu.au!glmwc From: glmwc@marlin.jcu.edu.au (Matt Crowd) Newsgroups: comp.sys.amiga.programmer Subject: Re: C questions (again) Summary: Is it really so strange? (sorry Morrissey!) Message-ID: <1991Feb11.110531.3898@marlin.jcu.edu.au> Date: 11 Feb 91 11:05:31 GMT References: <1991Feb7.114348.10577@marlin.jcu.edu.au> <18a64c31.ARN0d59@swinjm.UUCP> Organization: James Cook University of North Queensland Lines: 55 In article <18a64c31.ARN0d59@swinjm.UUCP> forgeas@swinjm.UUCP (Jean-Michel Forgeas) writes: >In article <1991Feb7.114348.10577@marlin.jcu.edu.au>, Matt Crowd writes: > >> input = (struct FileHandle *) Input(); // get filehandle of stdin >> printf("This is program 1!\n"); >> Execute("program2",input,0); // run program2 > ^^-----------------------------it's here >> printf("Because of something very wierd, this line " >> "will not be printed. I do not know why.\n"); > >The parameters of Execute() are: ( "program name", input, output ) >Since your "program2" does 'printf' it needs an output. It has not, >so it prints 'into the air'... and hangs. >This should work: > Execute("program2",input,Output()); No, that doesn't work. Execute takes parameters to redirect stdin/stdout, but if you pass 0 it uses the standard ones. Believe me, I've tried everything. I've now tried the console.device only to find out you have to do the arrow keys yourself for some strange reason (surely an option was in order!). Now I'm openning a CON: window with file = Open ("CON:0/0/640/400",MODE_OLDFILE); But that doesn't seem to work with Execute("dir",file,file) to get dir to appear in my own window. This is because Execute reads the file until EOF, which doesn't occur, so it gives a CLI prompt in my window! And as this is part of a larger program (similar to creating your own shell) I can't just redirect to a temporary file and display it. So it seems Execute is very CLIish (yes I just made that word up). I've been looking through the system and I'm pretty sure I can hack the OS to make it work properly, but I shouldn't have to. Under 2.0 the System call looks like it can take a parameter to a User shell, but I'm not sure if that's what I need, or really even what it is. Does anyone out there have any source code examples of using System(), which I think might have the same limitations, or other ways of redirecting commands to your own window while preserving input/output? Idea - Would avoiding SAS C calls, and having both programs run in the CLI, using Read && Write for i/o and getting the filehandles with Input()/ Output() solve the proglem? I think it might, so I'll try that... > \___/ >Jean-Michel Forgeas \-/ >cbmvax!cbmehq!cbmfra!swinjm!forgeas | The Software Winery > -^- > And, where is the universe ? Thanks, Colin Adams (soon to be an Amiga Developer, maybe it might help!)