Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!caen!kuhub.cc.ukans.edu!markv From: markv@kuhub.cc.ukans.edu Newsgroups: comp.sys.amiga.programmer Subject: Re: C questions (again) Message-ID: <28623.27bc0e9d@kuhub.cc.ukans.edu> Date: 15 Feb 91 22:38:52 GMT References: <1991Feb7.114348.10577@marlin.jcu.edu.au> <18a64c31.ARN0d59@swinjm.UUCP> <1991Feb11.110531.3898@marlin.jcu.edu.au> Organization: University of Kansas Academic Computing Services Lines: 105 In article <1991Feb11.110531.3898@marlin.jcu.edu.au>, glmwc@marlin.jcu.edu.au (Matt Crowd) writes: > 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. If you using SAS/Lattice and main(), then the startup will Open a CON: window for stdin/out. I'm still not sure why this doesn't work though. >>This should work: >> Execute("program2",input,Output()); Have you tried: In = Open("*", MODE_NEWFILE); Out = Open("*", MODE_NEWFILE); Execute("program2", In, Out); It might be that the original Input() and/or Output() were opened MODE_NEWFILE and dont like being shared, but I'm not a real DOS guru. > 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 Hmm, I could be off, but if your using a CON: window you wont get arrows, only RAW: gets arrows, FKeys, etc. > 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! What about: file = Open("*", MODE_OLDFILE); to get your current window. As a side note the Input and Output parameters to Execute() must have real DevProc()s associated with them (therefor NIL: will croak for one). > > 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). Yes, on the Amiga, (1.3 and before at least), there are some important differences between CLI and non-CLI processes. Just look at the CLI struct, etc for that. And yes, Execute is very CLIish, because it creates CLI type processes. > 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... Or, using SAS C, use _tinymain() and the amiga.lib I/O to get IO calls that use Amiga file handles. > >> \___/ >>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!) I'm one and I'm clueless here. I remember having similar problems when I tried hack up a jorunalizing facility for a CLI window. Good luck, -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark Gooderum Only... \ Good Cheer !!! Academic Computing Services /// \___________________________ University of Kansas /// /| __ _ Bix: mgooderum \\\ /// /__| |\/| | | _ /_\ makes it Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible... Internet: markv@kuhub.cc.ukans.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~