Re: write eof without closing

2006-08-21 Thread Grant Edwards
On 2006-08-21, Alex Martelli <[EMAIL PROTECTED]> wrote: > Grant Edwards <[EMAIL PROTECTED]> wrote: >... >> IIRC, ctrl-Z is not used _in_files_ to represent EOF. Only >> when text is being entered at the console. > > Easy to test, if you have Windows: I might, but I won't admit it in public. :

Re: write eof without closing

2006-08-20 Thread Fredrik Lundh
Alex Martelli wrote: >> IIRC, ctrl-Z is not used _in_files_ to represent EOF. Only >> when text is being entered at the console. > > Easy to test, if you have Windows: > n='foo.txt' s='ba\r\n'+chr(26)+'bo\r\r' open(n,'wb').write(s) ss=open(n).read() ss > 'ba\n' > > As

Re: write eof without closing

2006-08-20 Thread Alex Martelli
Grant Edwards <[EMAIL PROTECTED]> wrote: ... > IIRC, ctrl-Z is not used _in_files_ to represent EOF. Only > when text is being entered at the console. Easy to test, if you have Windows: >>> n='foo.txt' >>> s='ba\r\n'+chr(26)+'bo\r\r' >>> open(n,'wb').write(s) >>> ss=open(n).read() >>> ss 'ba\

Re: write eof without closing

2006-08-20 Thread Grant Edwards
On 2006-08-19, Tim Chase <[EMAIL PROTECTED]> wrote: >>> can i write a eof to a file descriptor without closing it? >> >> 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. > > Common Dos/Window convention also uses ctrl+

Re: write eof without closing

2006-08-20 Thread Fredrik Lundh
cage wrote: > 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

Re: write eof without closing

2006-08-19 Thread Philippe Martin
cage wrote: > hello > > can i write a eof to a file descriptor without closing it? > like: > fd.write(EOF) > or something > > grts, > ruben No but there is an EOF to the file anyway, even if it is open. I recall under MS-DOS, you could create a file of size N without writing to it (some INT21

Re: write eof without closing

2006-08-19 Thread cwarren89
Actually, nevermind. It appears that receiving an EOF from a stream tells it when to stop 'reading', not necessarily that the stream is closed. What a weird behavior. -- http://mail.python.org/mailman/listinfo/python-list

Re: write eof without closing

2006-08-19 Thread cwarren89
Writing the binary value for ^D into the stream will not do anything. That value signals the shell to close the stream, as such it only has significance when you're typing something into the shell. To the OP: writing an EOF to a stream without closing it makes no sense. EOF means just that--end of

Re: write eof without closing

2006-08-19 Thread Diez B. Roggisch
cage schrieb: > Marc 'BlackJack' Rintsch schreef: >> In <[EMAIL PROTECTED]>, cage wrote: >> >>> can i write a eof to a file descriptor without closing it? >>> like: >>> fd.write(EOF) >>> or something >> >> What do you expect this to to? Writing a byte to the file and you don't >> know which va

Re: write eof without closing

2006-08-19 Thread Lars
cage wrote: > 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.

Re: write eof without closing

2006-08-19 Thread Tim Chase
>> can i write a eof to a file descriptor without closing it? > > 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. Common Dos/Window convention also uses ctrl+Z (0x1a) for EOF. c:\> copy con test.txt hel

Re: write eof without closing

2006-08-19 Thread cage
Marc 'BlackJack' Rintsch schreef: > In <[EMAIL PROTECTED]>, cage wrote: > >> can i write a eof to a file descriptor without closing it? >> like: >> fd.write(EOF) >> or something > > What do you expect this to to? Writing a byte to the file and you don't > know which value this byte has? >

Re: write eof without closing

2006-08-19 Thread Grant Edwards
On 2006-08-19, cage <[EMAIL PROTECTED]> wrote: > can i write a eof to a file descriptor without closing it? 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 [EMAIL PROTECTED] -- http://mail.python.org/mail

Re: write eof without closing

2006-08-19 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, cage wrote: > can i write a eof to a file descriptor without closing it? > like: > fd.write(EOF) > or something 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 -- http:/

write eof without closing

2006-08-19 Thread cage
hello can i write a eof to a file descriptor without closing it? like: fd.write(EOF) or something grts, ruben -- http://mail.python.org/mailman/listinfo/python-list