PDA

View Full Version : How can I accomplish this?



BertMan
- 11th November 2005, 21:26
How can I store typed data of any length with a break on enter. In other words, if I type:

DEBUG "TYPE IN A NUMBER AND HIT ENTER"

How can I capture all numbers typed before the enter key was pressed and store them in a variable?

Dave
- 12th November 2005, 19:06
BertMan, I usually dont use Debug or Hserin in my programs but this is what I have done in the past to solve the same problem. Size an array for the most characters you anticipate being entered then clear the array before use. Use the string ending modifier for Hserin command and make it a carriage return character. That way if the buffer gets filled OR the string modifier is found the entry will be complete. The timeout between charcters is 1 second and if it is exceeded the Hserin command will be aborted. After the array is filled just unload it untill you see a zero and back it up by 1. I hope this helps.....

POINTER = 0 'clear pointer
WHILE POINTER < 11 'set for maximum of 12 characters
INDATA(POINTER) = 0 'clear array
POINTER = POINTER + 1
WEND
HSERIN 1000,EXIT,[STR INDATA\12\13] 'WAIT 1000mS. BETWEEN CHARACTERS

Dave Purola,
N8NTA

BertMan
- 28th November 2005, 15:38
Thanks for the reply. I am still working out other bugs and kindof left this part for later on, but I will use this method when I start making the menu.