Crashing When Creating a Process
<p>I am trying to use <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx" rel="nofollow">msdn function (CreateProcess</a>) in C++ in order to run an application. I don't get any errors but when I run it, it crashes. What I did also notice it that it created a process, but it didn't run the text file it was supposed to.</p>

<p>My code:</p>

<pre><code>#include &lt;windows.h&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

void createPro ();

int main()
{
    createPro();
}

void createPro () {

    LPCTSTR lpApplicationName = "C:/Users/Andyy/Desktop/hello.txt";

    LPSTARTUPINFO lpStartupInfo;
    LPPROCESS_INFORMATION lpProcessInfo;

    memset(&amp;lpStartupInfo, 0, sizeof(lpStartupInfo));
    memset(&amp;lpProcessInfo, 0, sizeof(lpProcessInfo));


    if (!CreateProcess(lpApplicationName,
                   NULL, NULL, NULL,
                   NULL, NULL, NULL, NULL,
                   lpStartupInfo,
                   lpProcessInfo
                  )
   ) {
    cout &lt;&lt; "Failed to create process" &lt;&lt; lpApplicationName &lt;&lt; endl;
}

    cout &lt;&lt; "Program exec: " &lt;&lt; lpApplicationName &lt;&lt; endl;
}
</code></pre>

<p>It creates the process but it fails to run the text file and no errors showed in compilers. Thanks in advance.
Return error: Process returned -1073741819 (0xC0000005)</p>