[comp.lang.c] spawn of.....hell, I can't get it to work

Bob.Stout@p6.f506.n106.z1.fidonet.org (Bob Stout) (11/09/89)

In an article of <6 Nov 89 07:33:21 GMT>, (Bob Calbridge) writes:

 >....  I invoke spawn in the form
 >
 >spawn (P_WAIT, defaults.dflt_ed, defaults.last_file, NULL);

  Try instead:

        spawnlp(P_WAIT, defaults.dflt_ed, defaults.deflt_ed,
                defaults.last_file, NULL);

  The spawnlp() function, means that the arguments are passed in the call as a  
NULL terminated list and that the PATH is searched to find the program to be  
executed. The first reference to defaults.dflt_ed is the actual name of the  
program to be spawned. The second is argv[0] and unused by DOS, but still  
required. Finally the arguments are passed beginning with argv[1] which, in  
your case, is defaults.last_file.