Home >Backend Development >C#.Net Tutorial >What is the system() function?

What is the system() function?

hzc
hzcOriginal
2020-07-04 14:51:444295browse

system is a C/C function. The detailed explanation of the system function under the Windows operating system is mainly applied in C language. The system function needs to be added with the header file before it can be called.

What is the system() function?system is a C/C function. The detailed explanation of the system () function under the Windows operating system is mainly applied in C language. The system function needs to be added with the header file 8e359799bdf1a571032ba13cc96acda9 before it can be called.

Function name: system

Function: Issue a DOS command

Usage: int system(char *command);

Program example:

#include <stdlib.h>
#include <stdio.h>
int main(void)
{
    printf("About to spawn and run a DOS command\n");
    system("dir");
    return 0;
}

Another example: system("pause") can freeze the screen to facilitate observing the execution results of the program; system("CLS") can clear the screen. Calling the color function can change the foreground color and background of the console. The specific parameters are explained below.

For example, use system("color 0A"); where the 0 after color is the background color code, and A is the foreground color code. The color codes are as follows:

0=black 1=blue 2=green 3=lake blue 4=red 5=purple 6=yellow 7=white 8=grey 9=light blue A=light green B=light green C=light red D=lavender E=light yellow F=bright white

(Note: Microsoft Visual C 6.0 supports system)

The color attribute consists of two sixteen Base digits specified - the first corresponds to the background, the second to the foreground. Each number

can be any of the following values:

0 = black 8 = gray

1 = blue 9 = light blue
 2 = green A = Light green
 3=Light greenB=Light light green
 4=RedC=Light red
 5=PurpleD=Light purple
 6=YellowE=Light yellow
 7=White F = bright white

Recommended tutorial: "c Language Tutorial"

The above is the detailed content of What is the system() function?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn