开发者

How can I read a whole line of input in Assembly?

开发者 https://www.devze.com 2023-02-13 02:26 出处:网络
The only subroutine I know of capable of reading a user\'s alphabetical input is read_char, but how I want to be able to read the user\'s whole input of char no matter how long.

The only subroutine I know of capable of reading a user's alphabetical input is read_char, but how I want to be able to read the user's whole input of char no matter how long.

I have a vague notion that I have to make memory room to store the开发者_如何学Go whole input or something? I'm really lost as I'm not certain if Assembly has a C++ equivalent of reading strings.

Thanks in advance.


Well, you should have a limit when reading input from the user, otherwise your program might not work properly anymore (see buffer overflow for more informations), so making room for the input and ensure the input won't exceed the buffer is very important.
Now, to get a string you have to call a dos interrupt, giving a pointer to your buffer and some other stuff. It will read until a carriage return is met.
But I think your prof wants you to read using his read_char, so (since this is homework), I'll give you a small advice: you have to do a loop and read chars until..

0

精彩评论

暂无评论...
验证码 换一张
取 消