Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdlib.h>
    int system( const char *command );
    int _wsystem( const wchar_t *command );

Description:
    If the value of command is NULL, then the system function determines
    whether or not a command processor is present ("COMMAND.COM" in DOS and
    Windows 95 or "CMD.EXE" in OS/2 and Windows NT).

    Otherwise, the system function invokes a copy of the command processor,
    and passes the string command to it for processing.  This function uses
    spawnl to load a copy of the command processor identified by the
     COMSPEC environment variable.

    This means that any command that can be entered to DOS can be executed,
    including programs, DOS commands and batch files.  The  exec...  and
     spawn...  functions can only cause programs to be executed.

    The _wsystem function is identical to system except that it accepts a
    wide-character string argument.

Returns:
    If the value of command is NULL, then the system function returns zero
    if the command processor is not present, a non-zero value if the command
    processor is present.  Note that Microsoft Windows 3.x does not support
    a command shell and so the system function always returns zero when
    command is NULL.

    Otherwise, the system function returns the result of invoking a copy of
    the command processor.  A non-zero value is returned if the command
    processor could not be loaded; otherwise, zero is returned.  When an
    error has occurred,  errno contains a value indicating the type of error
    that has been detected.

Example:
    #include <stdlib.h>
    #include <stdio.h>

    void main()
      {
        int rc;

        rc = system( "dir" );
        if( rc != 0 ) {
          printf( "shell could not be run\n" );
        }
      }

Classification:
    system is ANSI, POSIX 1003.2, _wsystem is not ANSI

Systems:
     system - All, Netware

    _wsystem - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32

See Also:
    abort, atexit, _bgetcmd, exec Functions, exit, _exit, getcmd, getenv,
    main, onexit, putenv, spawn Functions

See Also: abort atexit

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson