Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
October 30, 2004 Something other than printf/writef? | ||||
---|---|---|---|---|
| ||||
I hate printf. It's type usafe, it likes to crash etc., etc. I wish I could just:
char[] s;
int i;
file.scan(i).scan(s);
file.write("bla ").write(i);
and same with stdio. Can I?
--
Dawid Ciężarkiewicz | arael
jid: arael@fov.pl
|
October 30, 2004 Re: Something other than printf/writef? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dawid Ciężarkiewicz | You mention writef in your subject. D's writef (and writefln) is a typesafe version of printf. You find them in std.stdio.
Lars Ivar Igesund
Dawid Ciężarkiewicz wrote:
> I hate printf. It's type usafe, it likes to crash etc., etc.
> I wish I could just:
>
> char[] s;
> int i;
>
> file.scan(i).scan(s);
> file.write("bla ").write(i);
>
> and same with stdio. Can I?
|
October 30, 2004 Re: Something other than printf/writef? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | Lars Ivar Igesund wrote: > You mention writef in your subject. D's writef (and writefln) is a typesafe version of printf. You find them in std.stdio. Right. But I still got to use those "%s" etc. things ... -- Dawid Ciężarkiewicz | arael jid: arael@fov.pl |
October 30, 2004 Re: Something other than printf/writef? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dawid Ciężarkiewicz | Dawid Ciężarkiewicz wrote:
> Lars Ivar Igesund wrote:
>
>
>>You mention writef in your subject. D's writef (and writefln) is a
>>typesafe version of printf. You find them in std.stdio.
>
> Right. But I still got to use those "%s" etc. things ...
Nope, you don't have to.
writefln("foo ", 345, " bar ", 345.34, " baz");
you can use them though if you want formatting, like:
writefln("round(2): %2.2f", 345.34534);
|
October 30, 2004 Re: Something other than printf/writef? | ||||
---|---|---|---|---|
| ||||
Posted in reply to h3r3tic | "h3r3tic" <foo@bar.baz> wrote in message news:cm0iai$2ca$1@digitaldaemon.com... > Dawid Ciê¿arkiewicz wrote: > > Lars Ivar Igesund wrote: > > > > > >>You mention writef in your subject. D's writef (and writefln) is a typesafe version of printf. You find them in std.stdio. > > > > Right. But I still got to use those "%s" etc. things ... > > Nope, you don't have to. > Have you tried: writefln("%"); i can't try it now but i remember it used to not work. Btw (this is reply to Lars Ivar Igesund): writef is runtime type safe, it cheks all the types at runtime, while something like what David (and i) would like does compile time type checking. > writefln("foo ", 345, " bar ", 345.34, " baz"); > > you can use them though if you want formatting, like: > > writefln("round(2): %2.2f", 345.34534); |
October 30, 2004 Re: Something other than printf/writef? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dawid Ciężarkiewicz | Mango's got stuff like this.
On Sat, 30 Oct 2004 14:35:13 +0200, Dawid wrote:
> I hate printf. It's type usafe, it likes to crash etc., etc. I wish I could just:
>
> char[] s;
> int i;
>
> file.scan(i).scan(s);
> file.write("bla ").write(i);
>
> and same with stdio. Can I?
|
Copyright © 1999-2021 by the D Language Foundation