I would like to ask how can I stop a process programmatically using C ++?
Thank.
This is a platform dependent issue. Could you indicate the platform you are working on?
For windows you can use TerminateProcess
TerminateProcess
It depends on the platform. On Unix, you send a process a signal with kill(2).
kill(2)
Use the exitfunction to complete the call process. If you want to terminate the process without executing destructors for objects with automatic or static storage, you can use the function abort.
exit
abort
#include <windows.h> int main() { system("taskkill /f /im process.exe"); // replace process.exe with the name of process you want to stop/kill // /f is used to forcefully terminate the process // /im is used for imagename or in simple word it like wildcard return 0; }
Or can you go to How to kill processes by name? (Win32 API)
Source: https://habr.com/ru/post/1767599/More articles:Java java date and time values ββfrom String to Long to String - javaServlet includes runs HTTP headers in Tomcat - javaThe fastest scripting language for Java? - javaHow to make Unicode escape decoding in Antlr tokenizer - javaMagento - creating a new getProductCollection () function - magentoWhat is the best way in ASP.MVC2 to select an image to display in the controller - c #Select a row that matches the condition if no other rows match another condition - sqlSearch for applications without launching Market - androidCruiseControl.NET with web deployment project - msbuildjQuery ui autocomplete -.ui-autocomplete-loading - jqueryAll Articles