A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../algorithm/../../c/header/../program/system.html below:

system - cppreference.com

int system( const char *command );

Calls the host environment's command processor with the parameter command. Returns an implementation-defined value (usually the value that the invoked program returns).

If command is a null pointer, checks if the host environment has a command processor and returns a nonzero value if and only if the command processor exists.

[edit] Parameters command - character string identifying the command to be run in the command processor. If a null pointer is given, command processor is checked for existence [edit] Return value

Implementation-defined value. If command is a null pointer, returns a nonzero value if and only if the command processor exists.

[edit] Notes

On POSIX systems, the return value can be decomposed using WEXITSTATUS and WSTOPSIG.

The related POSIX function popen makes the output generated by command available to the caller.

[edit] Example

In this example there is a system call of the unix command date +%A and a system call to (possibly installed) gcc compiler with command-line argument (--version):

#include <stdlib.h>
 
int main(void) {
    system("date +%A");
    system("gcc --version");
}

Possible output:

Wednesday
gcc (GCC) 11.2.0
...
[edit] References
[edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4