This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

SUMMARY: console on demand?



Thanks all.

My original question was how to avoid getting a window if you
don't need one.

Compiling with the -mwindows flag solved that.
"Console" mode programs have a console window attached by default,
but "GUI" mode programs do not.

That led to a second problem.  How to use printf() and it's relatives
with a console window in a GUI mode program, when you DO need to
interact with the user.

A chain of calls like:

> handleout = GetStdHandle (STD_OUTPUT_HANDLE);
> fdout = _open_osfhandle(handleout);
> fpin = fdopen(fdout, "w");
> fprintf( fpin, "blurf");

solves the problem.

Tol suggests a more direct method, using freopen(), but it does
not seem to work for me.  Perhaps, as he suggests it works with
msvcrt, but not with crtdll.

Thanks again,

---
Jim Roy                      voice  541 757 7231
Sys. Admin.                  fax    541 757 7331
NW Geophysical Assoc.        http://www.nga.com
Corvallis Or. US
---

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]