0

我想创建一个接受输入并打印出结果的程序,但我无法创建一个可以接受字符串输入的空变量。这就是我的意思:

.data 
        emptyvar db ???? ; I don't know what to do here
.data? 
        buffer dd 100 dup(?)
.code
start:
        lea eax, buffer
        push eax
        call StdIn ; get input
        ; NOW HERE IS WHAT I DON'T KNOW WHAT TO DO:
        ; I know have input, what I want to do is print that result. But where 
        ; do I store the input and how do I print the result?

我知道我可以将一个整数存储在一个空变量中,并且可以打印它,但是如何创建一个空字符串变量呢?

任何帮助将不胜感激,

问候,

程序

4

1 回答 1

1
.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\masm32.inc
includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\masm32.lib


.data
msg1 db 'Please type your name',13,10,0
msg2 db 'Nice to see you ',0

.data?
buffer db 100 dup(?)
.code

start:
invoke StdOut,ADDR msg1
invoke StdIn,ADDR buffer,100 ; receive text input
invoke StdOut,ADDR msg2
invoke StdOut,ADDR buffer
invoke ExitProcess,0
END start
于 2012-05-21T02:17:38.037 回答