2016-03-19 13 views
5

Stimden nimscript ile nasıl okurum?Stdin'den nim betiği nasıl okunur?

i denedim:

if readLine(stdin) == "yes": 
    exec buildCommand 

i

nim c build.nims 

ile komut dosyasını çalıştırın ettik i

build.nims(50, 13) Error: undeclared identifier: 'stdin'

cevap

2
var f : File; 
discard f.open(0, fmRead) 

let s = f.readLine() 
echo "INPUT " & s 

işleri - Stdin bana `foo.nims (2, 10) Hata verir dosya tanıtıcısı 0

+0

sahiptir: bildirilmemiş rutini aramaya çalışmak: 'open'' ' Sürüm 0.13.0' – enthus1ast

+0

hmm'de var ... Bu sürümü de kullanıyorum. Benim için http://nim-lang.org/docs/system.html#open,File,FileHandle,FileMode (FileHandle sadece cint) – shaunc