Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - system http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   system

   Usage
   #include <stdlib.h>
   int system(const char *string);

   Description
   system  causes string to be given to the DOS command processor  as  if
   the string had been typed in at the console. The current program waits
   until the command is executed then resumes.

   There  is  no way to determine the exit status of programs  run  using
   system. Use one of the spawn functions if an exit status is required.

   Note  that since a separate copy of COMMAND.COM is loaded  when  using
   system  it cannot be used to set environment variables in the  current
   environment (i.e. that in existence when the program was run) with the
   SET command. For example, the code:

   system("SET ABC=DEF");
   will have no useful effect.

   (Use interrupt 2eh to achieve the above.)

   Example
   #include <stdlib.h>
   main()
   {
        system("set  >>path.log");
        system("cls");
        system("type path.log");
        system("pause");
        system("erase path.log");
        system("cls");
        system("ver");
        system("pause");
        system("cls");
        system("dir /w");
   }

   Return Value
   If  there was not enough available memory to load and run  command.com
   or  command.com  is  not found, then a -1 is returned,  else  a  0  is
   returned.


See Also: exec spawn

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