Thread overview
Something other than printf/writef?
Oct 30, 2004
Lars Ivar Igesund
Oct 30, 2004
h3r3tic
Oct 30, 2004
Ivan Senji
Oct 30, 2004
teqDruid
October 30, 2004
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
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
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
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
"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
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?

October 31, 2004
teqDruid wrote:
> Mango's got stuff like this.

I'll try it - thanks,
-- 
Dawid Ciężarkiewicz | arael
jid: arael@fov.pl