home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sftick.zip / beg / prog / PROG.C < prev    next >
Text File  |  1994-04-09  |  838b  |  32 lines

  1. #define INCL_DOSPROCESS
  2.  
  3. #include <os2.h>
  4. #include <stdio.h>
  5.  
  6. #define BUFFER_SIZE              200
  7.  
  8. INT main ( VOID )
  9. {
  10.    APIRET         arReturn ;
  11.    CHAR           achFail [BUFFER_SIZE] ;
  12.    RESULTCODES    rcResult ;
  13.  
  14.    /* execute the OS/2 command session, and pass the command dir *.* */
  15.    arReturn = DosExecPgm ( achFail,
  16.                            BUFFER_SIZE,
  17.                            EXEC_ASYNC,
  18.                            "CMD.EXE /C dir *.*\0",
  19.                            (PSZ) NULL,
  20.                            &rcResult,
  21.                            "CMD.EXE" ) ;
  22.  
  23.    /* print out return code */
  24.    if ( arReturn ) {
  25.       printf ( "\narReturn = %d", arReturn ) ;
  26.    } /* endif */
  27.  
  28.    /* print out return from session */
  29.    printf ( "\nrcResult = %ld", rcResult.codeResult ) ;
  30.    return 0 ;
  31. }
  32.