<cstdlib>下system函数的使用
2012-12-06 09:59
309 查看
int system(const char* command)
调用系统命令执行command。如果command为空,返回处理器是否可用(0不可用)。
使用例子
#include <stdlib.h> //or #include <cstdlib> system("dir");
这提供了与系统交互的接口,方便我们使用shell命令。
本人访问一个页面,本要使用curl,要设置很多参数,注意线程安全等,使用linux 的wget命令就方便多了。
string str="wget -q -O /dev/null http://www.baidu.com"; system(str.c_str());
补:cstdlib包含了c/c++最常用的系统函数,如malloc()、calloc()、realloc()、free()、system()、atoi()、atol()、rand()、srand()、exit()
相关文章推荐
- 使用< OBJECT >标记引用对象
- <context:component-scan>使用说明
- <office>office的一二个使用经验
- <c:forEach>标签与el表达式联合的使用
- 解决 spring mvc 3.0 结合 hibernate3.2 使用<tx:annotation-driven>声明式事务无法提交的问题
- &lt;转&gt;RestKit在iOS项目中的使用,包含xcode配置说明
- 如何使用<identity impersonate="true"/>
- <C/C++> IO流 cout/fstream的使用
- <jsp:useBean>的使用
- JSP 使用<%@include%>报Duplicate local variable path 错误 解决方法
- "<>"、"!="、"not in"、"exsits"和"not exists"的使用规范
- 在xml文件里使用<fragment>报android.view.InflateException: Error inflating class fragment
- <转>Android ORM 框架子 greenDao 使用心得
- 使用<shap>为Button加上阴影效果
- jsp使用<c:choose>标签来控制内容显示
- <s:iterator> 中的status 使用方法
- 解决 spring mvc 3.0 结合 hibernate3.2 使用<tx:annotation-driven>声明式事务无法提交的问题
- 使用<base target="_self" /> IE6 cann't open the Internet site 已终止操作
- <一>Oracle11g的安装+数据库创建+PL/SQL Dev的使用初步
- Xcode如何使用<>来引用静态库