writing

spir denis.spir at gmail.com
Thu Oct 14 10:02:07 PDT 2010


On Thu, 14 Oct 2010 08:05:09 +0000 (UTC)
"Lars T. Kyllingstad" <public at kyllingen.NOSPAMnet> wrote:

> On Thu, 14 Oct 2010 09:58:36 +0200, spir wrote:
> 
> > Hello,
> > 
> > write and writeln just write; writef and writefln first format: seems
> > clear. But the latter do not work properly with D strings, and the
> > former do not work without format. Is there a practical way to just
> > write anything to the terminal (without caring of its type)?
> > 
> > Is there some rationale about this?
> > Would it be possible to automatically add \0 to D strings passed to
> > write/writeln (can a programmer define a custom func doing this before
> > delegating to builtin funcs, or is it necessarily a job for the
> > compiler?)? And/or what about having writef/writefln use "%s" as default
> > format (when the first arg is not a string)?
> 
> 
> I don't understand what you mean.  This works just fine:
> 
>   import std.stdio;
> 
>   void main()
>   {
>       string s = "Hello world!";
>       writeln(s);
>   }
> 
> If I'm misunderstanding you, please explain, or perhaps give a code 
> example.
> 
> -Lars

Sorry, seems I just mistake the various C & D ways of coping with strings (too many forms of char arrays and functions that deal with them). I'll just stick with D funcs.

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d-learn mailing list