Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

system - Execute system command

&pagelevel(4)&pagelevel

Definition   

#include <stdlib.h>

int system(const char *cmd);

system executes the BS2000 system command in the string cmd.

Return val.

0

The system command was executed successfully (return value of the corresponding system command: 0).

-1

The system command was not executed successfully (return value of the system command: error code != 0).

The return value remains undefined (see "Notes") if control is not returned to the program following the system command.

Notes

The system command must not exceed a maximum length of 2048 characters and need not be specified with the system slash (/).

After certain commands (START-PROG, LOAD-PROG, CALL-PROCEDURE, DO, HELP-SDF), control is not returned to the calling program. If a program permits such premature program terminations, it should flush buffers (fflush) or close the files before the system call.

The system function passes on the cmd string as input to the BS2000 command processor MCLP without changing it (see also the "Executive Macros" manual). No conversion to 
uppercase is performed.

Example

#include <stdio.h>
#include <stdlib.h>
int main(void)
{
  char cmd[225];
  int result;
  printf("Please enter system command\n");
  gets(cmd);
  result = system(cmd);
  printf("Return value: %d\n", result);
  return 0;
}