RE: non-blocking read of stdin on windows
- From: "David Byron" <dbyron dbyron com>
- To: <gtk-devel-list gnome org>
- Subject: RE: non-blocking read of stdin on windows
- Date: Tue, 5 Jun 2007 10:18:32 -0700
On Wednesday, May 30, 2007 @ 11:44p, Tor Lillqvist wrote:
> What is stdin connected to in your case? Do you always mean the
> console window a console executable is attached to? Or do you want
> this to work in general, even if stdin has bee connected to whatever
> file or device, either through redirection on the command line,
> redirection in the the STARTUPINFO parameter to the CreateProcess()
> call, freopen(), or whatever? (D'oh, I assume you mean
> consoles always.)
stdin is connected to the console in my case.
> What you want to do typically would require Windows-specific ifdefs in
> your code to set the console to nonblocking mode. Sorry. Windows just
> isn't Unix.
>
> You might also be interested to know that in trunk GLib there is
> separate code to handle GIOChannels connected to consoles. (See bug
> #359202)
This is good info. PeekConsoleInput seemed like the kind of thing I was
looking for, but these comments explain what's really going on. I'm fine to
still call g_io_channel_read.
> I don't think so. The patch from bug #359202 only affected the polling
> of console file descriptors, not non-blocking mode as such. You still
> will have to use non-Glib platform-specific code to turn on
> non-blocking mode, I think. But I don't have personal experience from
> programming for console I/O on Windows... Experiment!
I'll likely punt and stick with waiting for the carriage return but if I get
inspired I'll give it a whirl.
> > Do 2.13.2 equivalents for [the prebuilt 2.12 Win32 GLib binaries
> > exist] ?
>
> Nope. If you want to use the development branch, you will have to
> compile it yourself. I guess I *could* be persuaded to upload to some
> non-public place prebuilt binaries of 2.13.2, though, hmm...
Thanks for the offer. What you've got up there is enough for me for now.
With any luck it will be until the next stable version.
-DB
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]