CHAR_INFO structure


This document describes console platform functionality that is no longer a part of our ecosystem roadmap. We do not recommend using this content in new products, but we will continue to support existing usages for the indefinite future. Our preferred modern solution focuses on virtual terminal sequences for maximum compatibility in cross-platform scenarios. You can find more information about this design decision in our classic console vs. virtual terminal document.

Specifies a Unicode or ANSI character and its attributes. This structure is used by console functions to read from and write to a console screen buffer.


typedef struct _CHAR_INFO {
  union {
    WCHAR UnicodeChar;
    CHAR  AsciiChar;
  } Char;
  WORD  Attributes;


A union of the following members.

Unicode character of a screen buffer character cell.

ANSI character of a screen buffer character cell.

The character attributes. This member can be zero or any combination of the following values.

Value Meaning
FOREGROUND_BLUE 0x0001 Text color contains blue.
FOREGROUND_GREEN 0x0002 Text color contains green.
FOREGROUND_RED 0x0004 Text color contains red.
FOREGROUND_INTENSITY 0x0008 Text color is intensified.
BACKGROUND_BLUE 0x0010 Background color contains blue.
BACKGROUND_GREEN 0x0020 Background color contains green.
BACKGROUND_RED 0x0040 Background color contains red.
BACKGROUND_INTENSITY 0x0080 Background color is intensified.
COMMON_LVB_LEADING_BYTE 0x0100 Leading byte.
COMMON_LVB_TRAILING_BYTE 0x0200 Trailing byte.
COMMON_LVB_GRID_HORIZONTAL 0x0400 Top horizontal.
COMMON_LVB_GRID_LVERTICAL 0x0800 Left vertical.
COMMON_LVB_GRID_RVERTICAL 0x1000 Right vertical.
COMMON_LVB_REVERSE_VIDEO 0x4000 Reverse foreground and background attribute.
COMMON_LVB_UNDERSCORE 0x8000 Underscore.


For an example, see Scrolling a Screen Buffer's Contents.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Header WinCon.h (include Windows.h)

See also