В Windows консоль - это всегда окно, похожее на окно командной строки. Вы можете открывать и читать и писать из / в эту вещь в вашей программе Windows. Это не буфер или текстовый файл, но вы можете написать буфер или текстовый файл, а затем перенести эту сущность на консоль.
Вот функции языка C, которые вы можете использовать при обращении к окну консоли:
_cgets, _cgetws, _cgets_s, _cgetws_s
Read string from console
_cprintf, _cwprintf, _cprintf_s, _cprintf_s_l, _cwprintf_s, _cwprintf_s_l
Write formatted data to console
_cputs
Write string to console
_cscanf, _cwscanf, _cscanf_s, _cscanf_s_l, _cwscanf_s, _cwscanf_s_l
Read formatted data from console
_getch, _getwch
Read character from console
_getche, _getwche
Read character from console and echo it
_inp
Read one byte from specified I/O port
_inpd
Read double word from specified I/O port
_inpw
Read 2-byte word from specified I/O port
_kbhit
Check for keystroke at console; use before attempting to read from console
_outp
Write one byte to specified I/O port
_outpd
Write double word to specified I/O port
_outpw
Write word to specified I/O port
_putch, _putwch
Write character to console
_ungetch, _ungetwch
"Unget" last character read from console so it becomes next character read