www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/10/05/00:18:43

From: shoham AT enel DOT ucalgary DOT ca (Idan Shoham)
Subject: SPAWN or EXEC under DV/X
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Fri, 30 Sep 1994 16:31:41 -0600 (MDT)

Hi all,

Well, I guess the subject line pretty much covers it -- has anyone
been able to get the spawn*() or exec*() functions to work while
running within DV/X?

In particular, I'm trying to spawn off a batch file, and get control
back either immediately (e.g., spawn off a simultaneous process), or
when it's done.  It really doesn't matter much which scenario is
achieved, just as long as we get a batch file to execute, and close
its window when it's done.

The code I'm using right now is as follows:

----------------------------------------------------------------------
        FILE *out;
 
        unlink("junk.dat");
        out = fopen("runme.bat","w");
        if( out==NULL ) {
            fprintf(stderr,"ERROR: Can't open runme.bat\n");
            exit(1);
            }
        fprintf(out,"dir > junk.dat\n");
        fprintf(out,"echo >> junk.dat Done!\n");
 
        fclose(out);
 
        spawnlp(P_WAIT,"","c:\\idanstuf\\runme.bat","",0);
----------------------------------------------------------------------

Thanks!

-- Idan


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019