0

我在 Windows 7 下使用TCC编译并运行了以下程序,结果应用程序崩溃:

#include <process.h>

int main(void)
{
    if (execlp("c:\\windows\\system32\\whoami.exe", "c:\\windows\\system32\\whoami.exe") < 0)
        perror("error");

    return 1;
}

以下是崩溃详情:

Problem signature:
Problem Event Name: APPCRASH
Application Name:   a.exe
Application Version:    0.0.0.0
Application Timestamp:  00000000
Fault Module Name:  msvcrt.dll
Fault Module Version:   7.0.7601.17744
Fault Module Timestamp: 4eeaf722
Exception Code: c0000005
Exception Offset:   0005b4fe
OS Version: 6.1.7601.2.1.0.256.1
Locale ID:  1033
Additional Information 1:   0a9e
Additional Information 2:   0a9e372d3b4ad19135b953a78882e789
Additional Information 3:   0a9e
Additional Information 4:   0a9e372d3b4ad19135b953a78882e789

为什么会发生这种情况,我该如何解决?

4

1 回答 1

3

您忘记将参数列表以空值结尾execlp()

参见例如http://linux.die.net/man/3/execlphttp://msdn.microsoft.com/en-us/library/vstudio/1kxct8h0.aspx

于 2013-07-14T20:17:14.727 回答