isatty and Pavel stream.d

Jarrett Billingsley jarrett.billingsley at gmail.com
Fri May 1 08:19:13 PDT 2009


On Fri, May 1, 2009 at 10:41 AM, carlos smith <carlos-smith at sympatico.ca> wrote:
> Hi!,
>
> What's the equivalent of the C isatty() in D?
> I grepped isatty in all sources files and did not
> find it.

isatty().  You can use any C function from D.  Phobos does not have a
terribly good set of Posix headers, so you'll have to declare it
yourself:

extern(C) int isatty(int);

And you should be able to use it.  You shouldn't get any linking
errors, at least I don't think.

> Also, i would like to know if anyone compiled the
> Pavel's stream.d library with a recent V1 D compiler.

You mean std.stream?  That's been part of Phobos .. well, forever.  At
least 5 years anyway.

> This library seems to allow reading utf-8 from a windows console.
>
> With dmd 1.043, it's very easy to write utf string to console. But, how do
> we readln from the console ?

std.stdio.readln.


More information about the Digitalmars-d-learn mailing list