delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/08/16/15:02:38

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>,
<http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Date: Mon, 16 Aug 99 11:49:57 PDT
From: jim AT nga DOT com (Jim Roy)
Message-Id: <9908161849.AA05189@nga.nga.com>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: 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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019