[Vala] Beginners question about keyboard input

I'm learning Vala, using the Genie syntax, and I'm stuck on something.
It would be great if a kind soul reading this would take a moment to
help me out.

I'm writing a console app and I want to read one line from the keyboard.
The C function gets() seems to be the one, however I get this this far:

        var a = new array of char[64]

But what I really want is a string, and I don't know how to convert an
array of chars to a string in Vala/Genie. Could someone tell me how?

Note, I searched the vala-list but the only posts about stdin.gets
show it used like this:

        stdin.gets(str, 256);

so it must have got redefined at some time.

Ah, it's so easy in Bash:

       read ONELINE

Barry Kauler

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]