[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

reading binary from STDIN in windows

Wybo Dekker

6/23/2005 8:10:00 PM

2 Answers

Shashank Date

6/23/2005 9:31:00 PM

0

Try this:

ruby -e 'STDIN.binmode;i=STDIN.read;
open("test.pdf","wb").write(i)' < some.pdf

Notice how binmode sets the binary mode.
-- shanko

--- Wybo Dekker <wybo@servalys.nl> wrote:

> Windows again -(
> How can I read a binary file from STDIN?
>
> For example, in linux I can copy some.pdf to
> test.pdf:
>
> ruby -e 'i=STDIN.read;
> open("test.pdf","w").write(i)' <some.pdf
>
> in windows I can (and must) use "wb" instead of "w",
> but how do I specify
> STDIN to be binary?
>
> (I need this for a filter working on pdf-files)
>
> --
> Wybo
>
>




____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports...


Wybo Dekker

6/24/2005 6:58:00 AM

0