Grabing C(++) stdout

John Colvin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 23 08:12:11 PDT 2014


On Wednesday, 23 July 2014 at 14:53:35 UTC, Chris wrote:
> Short question: how can I grab the stdout written to by C(++), 
> i.e.
>
> C code:
>
> fwrite(...);
>
> std.cstream will be replaced sooner or later.

I don't think I understand the question. stdout is the same file 
handle, doesn't matter whether that's using c++'s cout, c's 
stdout in stdio.h or D's std.stdio.stdout


writeln("hello world");

is just short for

stdout.writeln("hello world");


also, if you want c io functions, import core.stdc.stdio;


If you're wanting to grab the output from another process, take a 
look at std.process


More information about the Digitalmars-d-learn mailing list