Design Pattern Examples
Overview of object-oriented design patterns
enablevtmode.c File Reference

Implementation of the enableVTMode() function for configuring standard input to support the virtual terminal mode (on Windows). More...

#include <stdlib.h>
#include <stdio.h>
#include "enablevtmode.h"
Include dependency graph for enablevtmode.c:

Go to the source code of this file.

Functions

static void _restoreVTMode (void)
 Called by atexit() on program termination to restore the video mode.
 
void enableVTMode (void)
 Enables the virtual terminal processing mode on the current Windows Console. When the program ends, the state of the processing mode is restored to what it was before we got to it.
 

Detailed Description

Implementation of the enableVTMode() function for configuring standard input to support the virtual terminal mode (on Windows).

Definition in file enablevtmode.c.

Function Documentation

◆ _restoreVTMode()

static void _restoreVTMode ( void  )
static

Called by atexit() on program termination to restore the video mode.

Definition at line 24 of file enablevtmode.c.

Referenced by enableVTMode().

◆ enableVTMode()

void enableVTMode ( void  )

Enables the virtual terminal processing mode on the current Windows Console. When the program ends, the state of the processing mode is restored to what it was before we got to it.

This is for Windows only. Although the mode is enabled in all kinds of Windows console windows (terminal, powershell, etc.), only the Windows Command Prompt needs it; but it doesn't hurt to set it on the others (it's already set on those others).

This function uses an atexit() function to restore the mode on program exit.

Definition at line 39 of file enablevtmode.c.

References _restoreVTMode().

Referenced by main().