Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Thu Oct 14 01:05:09 PDT 2010

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!";

If I'm misunderstanding you, please explain, or perhaps give a code 


More information about the Digitalmars-d-learn mailing list