The MASM Forum
General => The Campus => Topic started by: x64Core on June 11, 2012, 04:17:13 AM
-
Hello guys, just I want to if is possile to read from the console?
took several hours searching, and I find nothing :shock: it's impossible?
My last hope is the forum where I know the wisest people in programming :biggrin:
-
WinAPI: ReadFile,ReadConsole
CRT: scanf,...
MASM32: input$()-macro,StdIn,...
...
-
:biggrin: thanks you qWord! :bgrin:
-
Hi RHL,
Here is a Simple console piping example (http://www.masmforum.com/board/index.php?topic=18215.0)
-
Hi RHL,
Here is a Simple console piping example (http://www.masmforum.com/board/index.php?topic=18215.0)
thanks Vortex, yeah, in really I wanted read, but data are already written on the console, not from the start of a function :P thanks guys
-
Here is the old HangMan example (http://www.movsd.com/board/index.php?topic=17936.msg151118#msg151118), demonstrating how to use Locate(x,y) in console mode. Another simple example:
include \masm32\MasmBasic\MasmBasic.inc ; download (http://masm32.com/board/index.php?topic=94.0)
Init
.Repeat
Let esi=Input$("What's your name? ", "RHL")
.Break .if word ptr [esi]!="HR"
Print "I asked for your name, not your nick!", CrLf$
.Until 0
Inkey "Hi ", esi, ", how are you?"
Exit
end start
-
Hi RHL,
Here is a Simple console piping example (http://www.masmforum.com/board/index.php?topic=18215.0)
thanks Vortex, yeah, in really I wanted read, but data are already written on the console, not from the start of a function :P thanks guys
RHL,
You can read the console output buffer, but only for your console screen, not an arbitrary console screen. See the API for GetConsoleScreenBufferInfo.
Dave.
-
It basically boils down to
invoke GetStdHandle, STD_INPUT_HANDLE
...
invoke SetConsoleMode, eax, ENABLE_LINE_INPUT or ENABLE_ECHO_INPUT or ENABLE_PROCESSED_INPUT
...
invoke ReadFile, hInput, pBuffer, bLen, ADDR bRead, NULL