C inside calls can be in the form of "system (" command ")".
But need to include <stdlib.h>
Examples are as Follows:
1#include <stdio.h>2#include <stdlib.h>3 intmain () {4 //Show current folder contents5System"dir");6 //Create a directory7System"mkdir philippian_test");8 //Create a Hehe.txt file in this directory9System"Touch Philippian_test/hehe.txt");Ten return 0; one}
The program,
1. Display the contents of the current folder
2. Create a folder (directory) named "philippian_test"
3. Create the file "hehe.txt" in this directory
(this system can be used with Linux commands, I often mix, windows can use notepad)
The created file was found in the Folder:
C + + is used directly inside
1 #include <iostream>2usingnamespace std; 3 int Main (intChar *Argv[]) {4 system ("date "); 5 return 0 ; 6
Display the current date with the date command:
How to invoke DOS commands in C C + +