Meta Project

The Unofficial Meta Documentation

READ

Summary

READ reads a line from STDIN

Category

GENERAL-IO

Usage

READ

Arguments

N.A.

Refinements

/LINE - takes in a line at one time. A line will be limited to 255 places.

Description

READ reads a line from STDIN, useful as READ/LINE for CGI scripting with method POST.

Example Code

text: select/case system/environment "REQUEST_METHOD"
if text = "POST" [
    ; Read from STDIN, this is for POST
    data-in: ""
    more-in: ""
    text: select/case system/environment "CONTENT_LENGTH"
    content-length-string: text
    if not is-none text [
        content-length: to whole! text
        rest-length: content-length
        while rest-length > 0 [
            more-in: READ/LINE
            data-in: join/with data-in more-in
            rest-length: rest-length - 255
        ]
        content-in: find/tail data-in "="
    ]
]

; For input from STDIN (user input)
data-in: TO STRING! READ/LINE

Related

TAKE  
APPEND  
ASK  

Back to the Meta Methods Reference index