写关闭而不关闭 [英] write eof without closing

查看:81
本文介绍了写关闭而不关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好


我可以写一个文件描述符而不关闭吗?

喜欢:

fd.write (EOF)

或者其他什么


grts,

ruben

hello

can i write a eof to a file descriptor without closing it?
like:
fd.write(EOF)
or something

grts,
ruben

推荐答案

在< ec ********** @ netlx020.civ.utwente.nl>中,cage写道:
In <ec**********@netlx020.civ.utwente.nl>, cage wrote:

我可以在不关闭它的情况下将eof写入文件描述符吗?

喜欢:

fd.write(EOF)

或者其他
can i write a eof to a file descriptor without closing it?
like:
fd.write(EOF)
or something



您对此有何看法?写一个字节到文件,你不知道
知道这个字节有哪个值?


Ciao,

Marc ''BlackJack''Rintsch

What do you expect this to to? Writing a byte to the file and you don''t
know which value this byte has?

Ciao,
Marc ''BlackJack'' Rintsch


2006-08-19,笼子< ca ****************** **@gmail.com写道:
On 2006-08-19, cage <ca********************@gmail.comwrote:

我可以在没有关闭文件描述符的情况下写一个eof吗?
can i write a eof to a file descriptor without closing it?



编号不适用于Windows,OS-X或Unix。没有这样的东西

一个eof。


在CP / M上,Ctrl-Z用作文本文件的EOF。


-

Grant Edwards
gr **** @ visi .com

No. Not on Windows, OS-X, or Unix. There is no such thing as
"an eof".

On CP/M Ctrl-Z is used as EOF for text files.

--
Grant Edwards
gr****@visi.com


Marc''BlackJack''Rintsch schreef:
Marc ''BlackJack'' Rintsch schreef:

在< ec ********** @ netlx020.civ.utwente.nl>中,cage写道:
In <ec**********@netlx020.civ.utwente.nl>, cage wrote:

>我可以写一个eof没有关闭它的文件描述符?
喜欢:
fd.write(EOF)
或者什么
>can i write a eof to a file descriptor without closing it?
like:
fd.write(EOF)
or something



你期待什么这到?写一个字节到文件,你不知道
知道这个字节有哪个值?


Ciao,

Marc ''BlackJack''Rintsch


What do you expect this to to? Writing a byte to the file and you don''t
know which value this byte has?

Ciao,
Marc ''BlackJack'' Rintsch



ok让我解释一下这个......

我想使用一个有一个程序''pipe''模式,你可以使用

stdin向程序发送命令。我发现,当你在管道中使用键盘作为输入源时你可以用Ctrl-D来表示

''信号''你的程序已完成输入您的命令。

程序解析然后执行命令,它不会退出。它'

退出''退出'\\''+ Ctrl-D

现在我想要一个python脚本来提供输入,我该怎么做?我现在

使用popen能够写入程序的stdin(p_stdin)

我注意到当我执行p_stdin.close()时它会充当一个''ctrl -d''那个

程序识别出处理命令的信号,但是后来我不能再使用p_stdin做p_stdin.write(。 ..)


grts,

ruben

ok let me explain this a bit more...
I want to use a program that has a ''pipe'' mode, in which you can use
stdin to send commands to the program. I found out that, when in pipe
mode and you are using the keyboard as input source you can do Ctrl-D to
''signal'' the program that you have finished typing your command. The
program parses and then performs the command, and it doesn''t quit. It
quits after ''Quit\n'' + Ctrl-D
Now I want a python script to provide the input, how do i do that? I now
use popen to be able to write to the program''s stdin (p_stdin)
I noticed that when i do a p_stdin.close() it acts as a ''ctrl-d'' in that
the program recognizes the signal to process the command, but then I
cannot use p_stdin anymore to do p_stdin.write(...)

grts,
ruben


这篇关于写关闭而不关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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