C language system function

C language system function

Function Introduction

The return value system different systems results are not the same
  C language library function call to all, can only guarantee that the syntax is the same, but can not guarantee that the results are consistent, the same library function to perform under different operating systems the result may be the same, it may be different.

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

Function: execute an external program in another program is already running
parameters: external executable name
Returns:
  Success: different systems return value is not the same
  failure: usually --1

Use Cases

#include <stdlib.h>
 
int main ()
{
       // System ( "Calc"); // Windows Platform 
       System ( " LS " ); // Linux platform, we need the header file #include <stdlib.h>
 
       return 0;
}
system use cases

 

Guess you like

Origin www.cnblogs.com/xiangsikai/p/12371524.html