如何从控制台获取红色语言的输入

How do I get input from the console in Red language

我正在用Red 语言编写一个控制台程序(目标MSDOS),我需要要求用户输入一个字符或字符串,然后按Enter

我似乎找不到如何去做,我已经阅读了这里的文档 (http://www.red-by-example.org/index.html) 无济于事。

我试过这样的事情:

read.red

Red [

]

print "Please make your choice then press Enter"
x: input
print x

它在 "Red Console" 和 red read.red 中工作,但是当我用 red -r -t MSDOS read.red 编译时我得到一个错误:

Compiling C:\apps\red-read\read.red ... *** Compilation Error: undefined word input *** in file: C:\apps\red-read\read.red *** near: [ input ]

如何从 Red 控制台程序请求输入?

我使用的是红色版本:--== Red 0.6.3 ==--

好的,我做了一些测试并让它在我这边工作。你需要两样东西。

1) 您需要最新版本,而不是 0.63。您可以从 the downloads page 的 master 获取自动构建。

2) 您需要在文件中引用才能使用控制台。这是更新后的代码,可以在 Windows 上使用最新版本。

Red [

]
#include %environment/console/CLI/input.red

print "Please make your choice then press Enter"
x: input
print x

此信息已隐藏在 github 的 article 中。另外,您对 MSDOS 的看法是正确的。