|REBOL 3 Docs||Guide||Concepts||Functions||Datatypes||Errors|
|TOC < Back Next >||Updated: 6-Feb-2009 Edit History|
The series copy function is used to read data from an open port:
print copy fp I wanted the gold, and I sought it,I scrabbled and mucked like a slave....
This function will wait for the port data. If you don't want to wait for the data, open the port with the /no-wait refinement.
To read only a portion of the port data, use copy/part:
print copy/part fp 35 I wanted the gold, and I sought it,
Note that the second argument to copy can be a length or a position within the port.
a: find fp "famine" print copy/part a find a newline famine or scurvy -- I fought it;
The first, next, and other positional series functions can also be used on the port:
print first fp I
print first next next fp w
tp: open/direct/binary/no-wait tcp://system:8000 content: make binary! 1000 while [wait tp data: copy tp] [append content data] close tp
|TOC < Back Next >||REBOL.com - WIP Wiki||Feedback Admin|