C++
--
Questions
--
Followers
Top Experts
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
PROCESS_INFORMATION procInfo;
STARTUPINFO startupInfo = {0};
startupInfo.cb = sizeof(STARTUPINFO);
char attr[] = "NotePad.exe -options";
char process[] = "NotePad.exe";
// start the ScriptFile
m_create = CreateProcess(process, attr,NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &procInfo);
if (m_create == 0) {
m_error = GetLastError();
}
else
{
// wait for process to finish...
while( processrunning( m_create ) ) { ... };
}
the following error messages i received after compiling the program....
c:\program files\microsoft visual studio\myprojects\ass12\as
c:\program files\microsoft visual studio\myprojects\ass12\as
c:\program files\microsoft visual studio\myprojects\ass12\as
c:\program files\microsoft visual studio\myprojects\ass12\as
c:\program files\microsoft visual studio\myprojects\ass12\as
Error executing cl.exe.
I'm sorry but i'm kinda new to c++..could u help me out with the entire code?? thanks...
#include <windows.h>
#include <iostream>
using namespace std;
bool finished;
// This is a thread function that just displays a " . " every second until
// the finished flag is set
DWORD WINAPI monitor_function(LPVOID parameter)
{
while(! finished)
{
std::cout << " . ";
Sleep(1000);
}
return 0;
}
int main()
{
// Set the startup information
STARTUPINFO startup_info = {0};
startup_info.cb = sizeof startup_info;
PROCESS_INFORMATION pi = {0};
finished = false; // Set a flag for the thread
// Create the process
DWORD result = CreateProcess("c:\\winnt\\
if(result == 0)
{
// Error
return 0;
}
// Create the thread that will wait for it to return
DWORD thread_id;
CreateThread(NULL, 0, monitor_function, NULL, 0, &thread_id);
// This function in this thread will wait for notepad to go away
::WaitForSingleObject(pi.h
finished = true; // Let the thread know
return 0;
}






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
// Local variables
PROCESS_INFORMATION pi;
STARTUPINFO si;
// Argument count
if (argc != 2)
return EXIT_FAILURE;
// Initialize
memset(&si,0,sizeof(si));
si.cb = sizeof(si);
// Execute
if(!CreateProcess(NULL, argv[1], NULL, NULL, false, 0, NULL,NULL,&si,&pi)) {
// Failed
cout << "Could not run the program." << endl;
return EXIT_FAILURE;
}
}
CAN ANYONE HELP ME ON THIS TO MAKE IT ERROR FREE???






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
C++
--
Questions
--
Followers
Top Experts
C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.