[comp.sys.amiga.tech] System

rwm@atronx.UUCP (Russell McOrmond) (11/01/90)

  I would VERY much like to thank the NetFolks for this one. It's always extremely
amazing how helpfull people are, and how many responses one gets to a querry on
the net. My example program had a LOT of problems in it.  For those interested,
here is the corrected and working System() example (So that others won't go through
the fun that I did trying to work it out).  Many thanks to all who have responded.


#include <stdio.h>
#include <dos/dostags.h>
#include <clib/dos_protos.h>

main(argc, argv)
	int argc;
	char *argv[];

{
        BPTR outfile,infile;
        struct TagItem systag[4];
        int rc, asyn;

        asyn = TRUE;

        if (!(outfile = Open("tempout",MODE_NEWFILE))) {
             printf("error opening outfile\n");
             exit(1);
        }

        if (!(infile = Open("tempin",MODE_OLDFILE))) {
             printf("error opening infile\n");
             Close(outfile);
             exit(1);
        }
            
        systag[0].ti_Tag = SYS_Input;
        systag[0].ti_Data = infile;
        systag[1].ti_Tag = SYS_Output;
        systag[1].ti_Data = outfile;
        systag[2].ti_Tag = SYS_Asynch;
        systag[2].ti_Data = asyn;
        systag[3].ti_Tag = TAG_END;

        rc = System(argv[1],systag);
        printf("%d from %s\n",rc,argv[1]);
        if (!asyn) {
           Close(infile);
           Close(outfile);
        }

}


---

  Russell McOrmond   rwm@atronx.UUCP   {fts1,alzabo}!atronx!rwm 
  FidoNet 1:163/109  Net Support: (613) 230-2282
  Amiga-Fidonet Support  1:1/109