What kind of handle must be passed as hConsoleOutput in WriteConsole()?
2025
What kind of handle must be passed as hConsoleOutput in WriteConsole()?
- A.
A memory-mapped I/O handle
- B.
A console output handle from GetStdHandle(STD_OUTPUT_HANDLE)
- C.
A pointer to a FILE structure
- 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).