Re: [hatari-devel] Hatari debug mode

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi Thorsten,

On 1.8.2025 19.16, Thorsten Otto wrote:
On Donnerstag, 31. Juli 2025 21:08:08 CEST Nicolas Pomarède wrote:
do you know if there's a way to detect in which "context" Hatari was
launched ?

You can use something like

CONSOLE_SCREEN_BUFFER_INFO ci;
	
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_INPUT_HANDLE),&ci))
     /* we already have a console */

Theoretically, using isatty(0) should also work, but unfortunately that fails
when using terminals like mintty, which use a pipe to communicate with the
process, and then isatty() from the MSVCRT returns 0, even if the program was
linked as console application.

What about detecting whether Hatari output is redirected to a file?


	- Eero




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/