int _System(const char * cmd, std::string& strRet)
{
FILE * fp;
char * p = NULL;
int res = -; if ((fp = _popen(cmd, "r")) == NULL)
{
printf("popen Error!\n");
return -;
}
else
{
char tempStr[];
memset(tempStr, , );
while (fgets(tempStr, , fp) != NULL)
{
strRet += tempStr;
} _pclose(fp);
return ;
}
}

php代码,文件命名为test.php:

<?php
$arg = $argv[1];
echo $arg;
?>

c++调用:

_System("php test.php helloworld");

c++输出结果:

helloworld

转载请注明出处,from博客园HemJohn

最新文章

  1. 使用Red Gate Sql Data Compare 数据库同步工具进行SQL Server的两个数据库的数据比较、同步
  2. 关于Advanced Installer 11.0打包软件过程一些记录
  3. Windows 10一周年更新正式版官方ISO镜像(1607)
  4. (期望)A Dangerous Maze(Light OJ 1027)
  5. 第二讲:WCF介绍(2)
  6. HD1160FatMouse&#39;s Speed(最长单调递增子序列)
  7. Object C学习笔记26-文件管理(二)
  8. iOS:堆(heap)和栈(stack)的理解
  9. [网络配置相关]——netstat命令
  10. centos 7 安装mp3解码器
  11. LeetCode_Palindrome Partitioning II
  12. ActiveReports 6:如何升级旧版本的项目
  13. JSON(一)——JSON与JavaScript的关系
  14. Unity Ragdoll 实现死亡效果 心得+坑点总结
  15. php错误提示 open_basedir restriction in effect 解决
  16. Java的接口、继承与多态
  17. Spring之Bean的作用域与生命周期
  18. SqlServer安装时的选项说明
  19. [水煮 ASP.NET Web API2 方法论](1-4)从 MVC Controller 链接到 API Controller 以及反向链接
  20. 模拟出ios中流行的黑色背景底

热门文章

  1. poj2241 The Tower of Babylon
  2. 9.Python初窥门径(函数初识)
  3. DOM事件-级别
  4. EXP-00000: Message 0 not found; No message file for product=RDBMS, facility=EXP问题的解决方案
  5. 黑马学习Ajax 概念和基本使用
  6. JavaScript进阶 - 第1章 系好安全带,准备启航
  7. CodeForces - 603A-Alternative Thinking (思维题)
  8. 安装redis服务器
  9. spring boot 事务
  10. 076 Minimum Window Substring 最小窗口子字符串