home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / spawnv.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  2KB  |  56 lines

  1. /***
  2. *spawnv.c - spawn a child process
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines _spawnv() - spawn a child process
  8. *
  9. *******************************************************************************/
  10.  
  11. #include <cruntime.h>
  12. #include <stdlib.h>
  13. #include <process.h>
  14. #include <tchar.h>
  15. #include <dbgint.h>
  16.  
  17. /***
  18. *int _spawnv(modeflag, pathname, argv) - spawn a child process
  19. *
  20. *Purpose:
  21. *       Spawns a child process.
  22. *       formats the parameters and calls _spawnve to do the actual work.  The
  23. *       NULL environment pointer indicates that the new process will inherit
  24. *       the parents process's environment.  NOTE - at least one argument must
  25. *       be present.  This argument is always, by convention, the name of the
  26. *       file being spawned.
  27. *
  28. *Entry:
  29. *       int modeflag   - mode to spawn (WAIT, NOWAIT, or OVERLAY)
  30. *                        only WAIT and OVERLAY currently implemented
  31. *       _TSCHAR *pathname - file to spawn
  32. *       _TSCHAR **argv    - vector of arguments
  33. *
  34. *Exit:
  35. *       returns exit code of child process
  36. *       if fails, returns -1
  37. *
  38. *Exceptions:
  39. *
  40. *******************************************************************************/
  41.  
  42. int __cdecl _tspawnv (
  43.         int modeflag,
  44.         const _TSCHAR *pathname,
  45.         const _TSCHAR * const *argv
  46.         )
  47. {
  48.         _ASSERTE(pathname != NULL);
  49.         _ASSERTE(*pathname != _T('\0'));
  50.         _ASSERTE(argv != NULL);
  51.         _ASSERTE(*argv != NULL);
  52.         _ASSERTE(**argv != _T('\0'));
  53.  
  54.         return(_tspawnve(modeflag,pathname,argv,NULL));
  55. }
  56.