On 09/15/2016 07:47 AM, dan hitt wrote:

Does anybody have any code out there in a project somewhere that uses IOChannel?

Specifically, i'm looking for an example where you read stdin and attach a function to watch it (where the watching takes place subsequent to Main.run). The attaching call would presumably be through ioAddWatch, but i'm not so clear on all the details of the arguments. I would be grateful to see an example in a working piece of code.

So, thanks in advance if this is possible and you have a piece of code you'd like to point to.

dan

I don't have any concrete examples, but i think you would create an
IOChannel for stdin, and than add an callback for the desired IO condition.

auto input = new IOChannel(STDIN_FILENO);
input.addWatch(IOCondition.IN, cast(IOFunc)&callb, null);

static extern(C) bool callb(GIOChannel* src, IOCondition cond, void* data)
{
	auto input = new IOChannel(src);

	...
}