ReadString (from Irvine32 Library) The ReadString procedure reads a string from the keyboard, stopping when the user presses the Enter key. Pass the offset of a buffer in EDX and set ECX to the maximum number of characters the user can enter, plus 1 (to save space for the terminating null byte). The procedure returns the count of the number of characters typed by the user in EAX. Sample call: .data buffer BYTE 21 DUP(0) ; input buffer byteCount DWORD ? ; holds counter remrk byte “Enter a string: “,0 .code main proc mov edx,OFFSET buffer ; point to the buffer mov ecx,SIZEOF buffer ; specify max characters call ReadString ; input the string mov byteCount,eax ; number of characters ReadString automatically inserts a null terminator in memory at the end of the string. The following is a hexadecimal and ASCII dump of the first 8 bytes of buffer after the user has entered the string “ABCDEFG". The variable byteCount equals 7.
ReadString (from Irvine32 Library) The ReadString procedure reads a string from the keyboard, stopping when the user presses the Enter key. Pass the offset of a buffer in EDX and set ECX to the maximum number of characters the user can enter, plus 1 (to save space for the terminating null byte). The procedure returns the count of the number of characters typed by the user in EAX. Sample call:
.data
buffer BYTE 21 DUP(0) ; input buffer
byteCount DWORD ? ; holds counter
remrk byte “Enter a string: “,0
.code
main proc
mov edx,OFFSET buffer ; point to the buffer
mov ecx,SIZEOF buffer ; specify max characters
call ReadString ; input the string
mov byteCount,eax ; number of characters
ReadString automatically inserts a null terminator in memory at the end of the string. The following is a hexadecimal and ASCII dump of the first 8 bytes of buffer after the user has entered the string “ABCDEFG". The variable byteCount equals 7.
Get a string from a user using ReadString procedure. Your output should be shown as below.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps