CHAR_INFO structure

Important

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.

Syntax

typedef struct _CHAR_INFO {
  union {
    WCHAR UnicodeChar;
    CHAR  AsciiChar;
  } Char;
  WORD  Attributes;
} CHAR_INFO, *PCHAR_INFO;

Members

Char
A union of the following members.

UnicodeChar
Unicode character of a screen buffer character cell.

AsciiChar
ANSI character of a screen buffer character cell.

Attributes
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.

Examples

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

Requirements

   
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

ReadConsoleOutput

ScrollConsoleScreenBuffer

WriteConsoleOutput