Using CMD commands in C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Using CMD commands in C++

Which command I need to write to use CMD commands in C++ and which library I need to include. I want to create some gifts for my friends.

13th Aug 2020, 2:12 AM
Mr-Powerful
Mr-Powerful - avatar
4 Answers
+ 4
Have you tried "system"? More detail and examples are at: https://www.tutorialspoint.com/system-function-in-c-cplusplus#:~:text=The%20system%28%29%20function%20is%20a%20part%20of%20the,returns%20the%20command%20after%20it%20has%20been%20completed. In Unix and probably linux also, there are some functions for c programs that give you more control over the running program. Functions like fork, exec, and pipe can help you redirect standard input, output, and standard error of the other process.
13th Aug 2020, 3:17 AM
Josh Greig
Josh Greig - avatar
+ 2
You can make use of system() function to pass an command to comand line if the OS allows. Go here to learn more about system() 👇 https://www.geeksforgeeks.org/system-call-in-c/
13th Aug 2020, 3:19 AM
Arsenic
Arsenic - avatar
13th Aug 2020, 6:43 AM
Ockert van Schalkwyk
Ockert van Schalkwyk - avatar
0
I think system pause is like this
13th Aug 2020, 3:20 AM
Mr-Powerful
Mr-Powerful - avatar