Answer the question
In order to leave comments, you need to log in
How to run child C/C++ defrag process?
There is a console menu.
You need to start a child process with parameters. Here is an attempt to defragment drive C. What's wrong? spawnl(P_WAIT,"defrag","C",NULL);
UPD:
#include "stdafx.h"
#include "windows.h"
void main()
{
STARTUPINFO cif;
ZeroMemory(&cif,sizeof(STARTUPINFO));
PROCESS_INFORMATION pi;
CreateProcess(L"c:\\windows\\system32\\defrag.exe",NULL,
NULL,NULL,FALSE,NULL,NULL,NULL,&cif,&pi);
}
Answer the question
In order to leave comments, you need to log in
You better know what's wrong. It would be nice to specify the expected and actual behavior. I assume that specifying the absolute path to the file will solve the problem. You can also look at CreateProcess in order not to use any wrappers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question