From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/program%2Fsystem.html | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 devdocs/c/program%2Fsystem.html (limited to 'devdocs/c/program%2Fsystem.html') diff --git a/devdocs/c/program%2Fsystem.html b/devdocs/c/program%2Fsystem.html new file mode 100644 index 00000000..40e60354 --- /dev/null +++ b/devdocs/c/program%2Fsystem.html @@ -0,0 +1,33 @@ +

system

Defined in header <stdlib.h>
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.

+

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

Return value

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

+

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.

+

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
+...

References

See also

+
C++ documentation for system
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/program/system +

+
-- cgit v1.2.3