Windows编程中的Console是什么意思?

发布于 2024-12-10 07:52:44 字数 358 浏览 0 评论 0原文

我的 Windows 控制台有问题...在 Windows api 中,控制台 是否始终必须是屏幕或键盘,还是可以是任何字符缓冲区或文本文件之类的东西?

如果我更具体的话

,Windows API 中的 SetConsoleMode 功能有一个名为 hConsoleHandle 的参数,它有一个名为 ENABLE_ECHO_INPUT 的标志,可用于回显我们在屏幕上读到的每个字符..所以我认为在Windows系统编程中,控制台的含义超出了正常的含义...那么我是在写吗?如果是的话,真正的含义是什么..?

再次感谢

I've got a problem with windows consoles... In windows api, does a console always has to be a screen or a keyboard or can it be any character buffer or something like a text file ?

thanx

If I be more specific, SetConsoleMode fnction in windows api has a parameter called hConsoleHandle which has a flag called ENABLE_ECHO_INPUT that can be used to echo every character we read to the screen.. So I thought in windows system programming, Console means something more than it's normal meaning... So am I write and if so what is the true meaning..?

thanx again

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蓝眸 2024-12-17 07:52:44

不,“控制台”意味着具有基于文本的界面的应用程序。

维基百科上的 Win32 Console 表示该标签指定在 Windows API 下运行的文本模式程序,并且例如,将使用像 WriteConsole 这样的函数,而不是 printfcout

因此,控制台是相同的,但底层库不同。

No, a "console" implies an application that has a text-based interface.

Win32 Console on Wikipedia says that that label specifies a text mode program that runs under the Windows API, and would use, for example, a function like WriteConsole instead of printf or cout.

So, the console's the same, but the underlying library is different.

回梦 2024-12-17 07:52:44

正如此处详细描述的那样

Consoles manage input and output (I/O) for character-mode applications 
(applications that do not provide their own graphical user interface).

所以你的答案就在那里。正如之前所问的,请尝试更好地解释您的背景、您的目标以及您的想法,这样也许我们可以为您提供更多帮助。

As it's well described here

Consoles manage input and output (I/O) for character-mode applications 
(applications that do not provide their own graphical user interface).

so you have your answer right there. As asked before, try to explain better your context, your objective and what is your idea, so maybe we can help you out more.

巷雨优美回忆 2024-12-17 07:52:44

在 Windows 下,控制台始终是一个类似于命令提示符窗口的窗口。您可以在 Windows 程序中打开该东西并对其进行读写。它不是缓冲区或文本文件,但您可以编写缓冲区或文本文件,然后将该实体传输到控制台。

windows console

以下是在访问控制台窗口时可以使用的 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

Under Windows, the console is always a window that resembles the Command Prompt window. You can open and read and write from/to that thing in your windows program. It's not a buffer or a text file, but you can write a buffer or text file and then transfer that entity to the console.

windows console

Here are the C-language functions you can use when you address the console window:

_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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文