Where is stdout?

Jonathan M Davis jmdavisprog at gmail.com
Wed Aug 4 11:52:58 PDT 2010


On Wednesday, August 04, 2010 11:38:28 Andrej Mitrovic wrote:
> From TDPL, page 161:
> 
> import std.conv;
> 
> void writeln(T...)(T args)
> {
>     foreach (arg; args)
>     {
>         stdout.rawWrite(to!string(arg));
>     }
>     stdout.rawWrite('\n');
>     stdout.flush();
> }
> 
> void main()
> {
>     writeln("test");
> }
> 
> test.d(10): Error: undefined identifier stdout

std.stdio - which is what you usually import for doing I/O. Of course, it 
actually defines writeln(), so it's not like you need to write it yourself - not 
to mention, you can always just look at stdio.d in the phobos src (which gets 
downloaded with dmd) to see its exact implementation if you want to.

- Jonathan M Davis


More information about the Digitalmars-d mailing list