是否可以在Linux中将数据写入自己的stdin中 [英] Is it possible to write data into own stdin in Linux

查看:296
本文介绍了是否可以在Linux中将数据写入自己的stdin中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从IDE调试我的cgi脚本(C ++),所以我想创建一个调试模式":从磁盘读取文件,将其推送到自己的stdin,设置一些与该文件相对应的环境变量并运行Web服务器调用的脚本的其余部分.是否可能,如果可以,我该怎么做?

I want to debug my cgi script (C++) from IDE, so I would like to create a "debug mode": read file from disk, push it to own stdin, set some environment variables, that correspond this file and run the rest of the script as it was called by the web server. Is it possible and if it is, then how can I do that?

推荐答案

您不能推送到自己的stdin",但是可以将文件重定向到您自己的stdin.

You can't "push to own stdin", but you can redirect a file to your own stdin.

freopen("myfile.txt","r",stdin);

这篇关于是否可以在Linux中将数据写入自己的stdin中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆