2016-10-03 59 views

回答

3

您可以先通过格式字符串和参数将io_lib:format/2,然后发送到io:get_line/1

1> Variable = "Name". 
"Name" 
2> io:get_line(io_lib:format("~s: ", [Variable])). 
Name: Dogbert 
"Dogbert\n" 
+0

谢谢你这个作品! – wency

0

可以使用fread/3功能:

读取从标准输入(IoDevice)字符,提示促使它。根据格式解释字符。格式包含指导输入解释的控制序列。

+0

嗯,我的意思是,我喜欢把一个变量'IO内:get_line()'提示符。像 'IO:get_line( “〜S:”,[变量])' 将转化为 。 'Somevar:' – wency