读书人

system,该怎么解决

发布时间: 2012-05-24 11:55:41 作者: rapoo

system
请问system都有什么用法,为什么有时候需要#include <windows.h>,有时候却不用#include <windows.h>?

[解决办法]
函数使用应该自己google、查MSDN或者man。
[解决办法]
基本上所有的CMD命令都支持,当然你要格式正确!~
[解决办法]
MSDN的解释:

The system function executes an internal operating system command, or an .EXE, .COM (.CMD in Windows NT) or .BAT file from within a C program rather than from the command line.
system需要的头文件:
<process.h> or <stdlib.h>

[解决办法]
system可以调用系统的命令。平时在CMD里面写的命令,一般都可以放到system函数里面执行。这样就可以很方便地使用别人写好的系统命令。也可以在system里面调用自己之前写好的一个exe文件。
这个函数一般需要<stdlib.h>或者<process.h>头文件。
[解决办法]

探讨

引用:

MSDN的解释:

The system function executes an internal operating system command, or an .EXE, .COM (.CMD in Windows NT) or .BAT file from within a C program rather than from the command ……

[解决办法]
system就是执行shell command的函数,没别的。

读书人网 >C语言

热点推荐