[REBOL] Re: Binary reading from stdin
From: andreas::bolka::gmx::net at: 18-Feb-2002 18:42
Monday, February 18, 2002, 12:44:54 PM, Gabriele wrote:
>>I'm trying to write a program that reads binary data from fd 0
>>(stdin). Is there any way to accomplish that with REBOL?
> stdin is system/ports/input. You'll have to do something like:
> set-modes system/ports/input [binary: yes]
> data: copy system/ports/input
that's exactly what i do - but it does not seem to work. i'm quite
sure that it's the fault of my program (not the callers fault).
. set-modes system/ports/input [ binary: true lines: false ]
. probe get-modes system/ports/input [ binary lines ]
. probe copy/part system/ports/input 8
; [binary: true lines: false]
; #{}
when i try to read-io, read-io returns -1. system/ports/input looks as
attached:
. probe system/ports/input
[i replaced every occurrence of paths with /path/to/script]
make object! [
scheme: 'file
host: none
port-id: none
user: none
pass: none
target: %input
path: %/path/to/script/
proxy: none
access: none
allow: none
buffer-size: none
limit: none
handler: none
status: none
size: none
date: none
url: none
sub-port: none
locals: none
state:
make object! [
flags: 67633697
misc: [0 0 "/path/to/script/input"]
tail: 0
num: 0
with: "^/"
custom: none
index: 0
func: 1
fpos: 0
inBuffer: none
outBuffer: none
]
timeout: none
local-ip: none
local-service: none
remote-service: none
last-remote-service: none
direction: none
key: none
strength: none
algorithm: none
block-chaining: none
init-vector: none
padding: none
async-modes: none
remote-ip: none
local-port: none
remote-port: none
backlog: none
device: none
speed: none
data-bits: none
parity: none
stop-bits: none
rts-cts: true
user-data: none
awake: none
]
--
Best regards,
Andreas mailto:[andreas--bolka--gmx--net]