c++ 调用php
2024-09-25 18:48:33
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
最新文章
- 使用Red Gate Sql Data Compare 数据库同步工具进行SQL Server的两个数据库的数据比较、同步
- 关于Advanced Installer 11.0打包软件过程一些记录
- Windows 10一周年更新正式版官方ISO镜像(1607)
- (期望)A Dangerous Maze(Light OJ 1027)
- 第二讲:WCF介绍(2)
- HD1160FatMouse&#39;s Speed(最长单调递增子序列)
- Object C学习笔记26-文件管理(二)
- iOS:堆(heap)和栈(stack)的理解
- [网络配置相关]——netstat命令
- centos 7 安装mp3解码器
- LeetCode_Palindrome Partitioning II
- ActiveReports 6:如何升级旧版本的项目
- JSON(一)——JSON与JavaScript的关系
- Unity Ragdoll 实现死亡效果 心得+坑点总结
- php错误提示 open_basedir restriction in effect 解决
- Java的接口、继承与多态
- Spring之Bean的作用域与生命周期
- SqlServer安装时的选项说明
- [水煮 ASP.NET Web API2 方法论](1-4)从 MVC Controller 链接到 API Controller 以及反向链接
- 模拟出ios中流行的黑色背景底
热门文章
- poj2241 The Tower of Babylon
- 9.Python初窥门径(函数初识)
- DOM事件-级别
- EXP-00000: Message 0 not found; No message file for product=RDBMS, facility=EXP问题的解决方案
- 黑马学习Ajax 概念和基本使用
- JavaScript进阶 - 第1章 系好安全带,准备启航
- CodeForces - 603A-Alternative Thinking (思维题)
- 安装redis服务器
- spring boot 事务
- 076 Minimum Window Substring 最小窗口子字符串