Re: [Vala] Formatting printf output



All this works fine for me:

stdout.printf("@b%s\n", "Name");
stdout.printf("%.3f\n", 3.13111415);

string s = "@b%s\n".printf("Name");
stdout.printf(s);
s = "%.3f\n".printf(3.129381);
stdout.printf(s);

On Mon, Mar 7, 2016 at 9:00 PM Steven Oliver <oliver steven gmail com>
wrote:

When converting C code to Vala there are a lot of times I want to convert
printf formatting. It doesn't appear to just cleanly convert though.

This C for example:

sprintf(str, "@b%s", "Name");

sprintf(str,"Example number: %.3f", 31.30233);

When try just passing the equivalent formatting to vala I just @ signs
beside my strings and "3f"s littered throughout my code. Any one have any
experience with this?

Steven N. Oliver
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list



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