-1

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

psaw.mora
  • 868
  • 1
  • 7
  • 18
  • 4
    Can you clarify the context of your question? Knowing what you are trying to accomplish will help someone provide a better answer. – jonsca Oct 16 '11 at 09:29

3 Answers3

1

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
Pete Wilson
  • 8,610
  • 6
  • 39
  • 51
1

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.

jonsca
  • 10,218
  • 26
  • 54
  • 62
1

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.

Samuele Mattiuzzo
  • 10,760
  • 5
  • 39
  • 63