在本项目中调用system指令,运行别的项目生成的exe,如何实现的?
刚看这代码,运行了,也不知道到底调用没有.到另一项目里面单独运行xx.exe不行,缺少库什么的
望指点

解决方案 »

  1.   

    int system( const char *command );
    <process.h> or <stdlib.h>
    LIBC.LIB Single thread static library, retail version 
    LIBCMT.LIB Multithread static library, retail version 
    MSVCRT.LIB Import library for MSVCRT.DLL, retail version Return ValueIf command is NULL and the command interpreter is found, the function returns a nonzero value. If the command interpreter is not found, it returns 0 and sets errno to ENOENT. If command is not NULL, system returns the value that is returned by the command interpreter. It returns the value 0 only if the command interpreter returns the value 0. A return value of – 1 indicates an error, and errno is set to one of the following values:E2BIGArgument list (which is system-dependent) is too big.ENOENTCommand interpreter cannot be found.ENOEXECCommand-interpreter file has invalid format and is not executable.ENOMEMNot enough memory is available to execute command; or available memory has been corrupted; or invalid block exists, indicating that process making call was not allocated properly.ResThe system function passes command to the command interpreter, which executes the string as an operating-system command. system refers to the COMSPEC and PATH environment variables that locate the command-interpreter file (the file named CMD.EXE in Windows NT). If command is NULL, the function simply checks to see whether the command interpreter exists.You must explicitly flush (using fflush or _flushall) or close any stream before calling system.
      

  2.   

    可是 调试运行到system("xx.exe")的 时候,就看见一个dos窗口出来了一下,就完了。怎么进入xx.exe调试呢?
    运行xx了吗?
    直接调用的system("xx.exe")
    如何看返回值呢