What kind of handle must be passed as hConsoleOutput in WriteConsole()?

2025

What kind of handle must be passed as hConsoleOutput in WriteConsole()?

  1. A.

    A memory-mapped I/O handle

  2. B.

    A console output handle from GetStdHandle(STD_OUTPUT_HANDLE)

  3. C.

    A pointer to a FILE structure

  4. D.

    A handle returned by fopen()

Attempted by 7 students.

Show answer & explanation

Correct answer: B

In the Windows API, the WriteConsole() function is used to write characters directly to the console screen. The parameter hConsoleOutput must be a valid console output handle, which is commonly obtained using:

GetStdHandle(STD_OUTPUT_HANDLE)

This handle represents the standard output device (console screen).

Explore the full course: Niacl Ao It Specialist