Re: STDOUT_FILENO and STDERR_FILENO
- From: John Emmas <johne53 tiscali co uk>
- To: gtk-devel-list gnome org
- Cc: gtk-devel-list <gtk-devel-list gnome org>
- Subject: Re: STDOUT_FILENO and STDERR_FILENO
- Date: Mon, 20 May 2013 14:06:30 +0100
On 20/05/2013 13:45, Erik van Pienbroek wrote:
When an executable is built with '-mwindows' (instead of '-mconsole') then
there is no stdout/stderr by default. To get a stdout/stderr one has to use
the win32 API functions AttachConsole and freopen which in turn will
return different file descriptors than 1 and 2.
That's interesting. I've often used AttachConsole and freopen myself
but it never occurred to me to check whether the file descriptors were
still 1 and 2.
So this probably means that my sample called
"gtestutils.c.alternative-2.patch" is the safest one to choose, since it
doesn't make any assumptions about the file descriptor values. Also (in
theory) it should only attempt to write to the console if stdout /
stderr appears to be valid (hopefully Windows would set them to NULL if
they weren't valid?).
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]