Example: Read a formatted string

static int main (string[] args) {
int num = 0;
print ("What's your favorite integer?\n");
stdin.scanf ("%d", &num);
print ("%d? Really?\n", num);
return 0;
}

 valac --pkg glib-2.0 GLib.FileStream.scanf.vala

See:




2022 vala-language.org