CC004019@BROWNVM.BITNET (Christopher Chung) (06/30/87)
Is there a way to have the INPUT statement in BASIC not give the error ?EXTRA IGNORED when a comma is inputted along with the rest of the characters? I remember reading something about this a long time ago but can't remember where. Can anyone help? Thanks, Chris Acknowledge-To: <CC004019@BROWNVM>
muller@alliant.UUCP (07/08/87)
In article <8706300937.aa12986@SMOKE.BRL.ARPA> CC004019@BROWNVM.BITNET (Christopher Chung) writes: >Is there a way to have the INPUT statement in BASIC not give the error >?EXTRA IGNORED when a comma is inputted along with the rest of the characters? >I remember reading something about this a long time ago but can't remember >where. Can anyone help? The proper approach is to avoid using INPUT at all. Instead, read input character by character using GET. (If you are reading numerical input, you will have to convert these to values, but it isn't too hard.) After each character is entered, it can be added onto the end of the already existing input string. The Applesoft (or was it the DOS3.3?) manuals used to give such an example as an "input anything" routine.
chris@hplvdd.HP.COM (Chris Kelly) (07/08/87)
You can use the GETLN subroutine at -662 (decimal) which fills the input buffer at $200 to $2FF (512 to 767 decimal). for example: 100 BF$="":rem clear string variable 110 CALL -662 : rem call GETLN 120 for i = 512 to 767 130 x=peek(i)-128 :rem get element of buffer 140 BF$=BF$+chr$(x) 150 next i I think that this will work for virtually any character including commas and semicolons. BF$ is your string buffer. It takes a little more work, but you can enter commas, etc this way. Good luck, ...chris
shanku@sq.UUCP (07/09/87)
In article <8706300937.aa12986@SMOKE.BRL.ARPA> CC004019@BROWNVM.BITNET (Christopher Chung) writes: >Is there a way to have the INPUT statement in BASIC not give the error >?EXTRA IGNORED when a comma is inputted along with the rest of the characters? >I remember reading something about this a long time ago but can't remember >where. Can anyone help? > There was an article some time back in COMPUTE magazine which got rid of this error, and also allowed formulas to be entered as input. The EXTRA IGNORED error is strange because an ON ERR GOTO will not catch it. If you can't find the article, you can always write your own input routine using the GET statement. It would go something like this: 1000 R$="" 1010 PRINT "?";:REM INPUT PROMPT 1020 GET A$ 1030 IF A$=CHR$(13) THEN GOTO 1060:REM DONE 1040 IF A$=CHR$(8) AND LEN(R$)>0 THEN PRINT A$;:R$=LEFT$(R$,LEN(R$)-1):GOTO 1020:REM BACKSPACE 1050 R$=R$+A$:PRINT A$;:GOTO 1020 1060 RETURN You could use this to add all sorts of features to your input, like a different prompt, or default values.
mat6013@DMZRZU71.BITNET (07/13/87)
The easiest way to INPUT commas (or colons) as a normal character is to type a double quote before the line you wish to enter. The double quote will be stripped off the input by the interpreter and not stored in the string variable. A closing quote is not needed, but can be supplied and will be treeted like the one at the beginning. Example: to enter: Here,are:a,lot:of,commas:and,colons:around. you type: "Here,are:a,lot:of,commas:and,colons:around. But when fixing the problem this way you can't include a double quote in the same string because it will be interpreted as the closing one. (An input not starting with a double quote can include an arbitrary number of them without any special action taken by Applesoft.) The reason for this behaviour is that the same internal routine is used for parsing both the user response to an INPUT (and a GET) and the arguments of a DATA. A more comfortable solution would be to use an "input everything" routine published in various Apple magazines or an appropriate command offered by some commercial BASIC extensions. Matthias Kapffer <MAT6013@DMZRZU71.BITNET>
dr@ski.UUCP (David Robins) (07/16/87)
In article <> chris@hplvdd.HP.COM (Chris Kelly) writes: > >You can use the GETLN subroutine at -662 (decimal) which fills the input >buffer at $200 to $2FF (512 to 767 decimal). > >for example: >100 BF$="":rem clear string variable >110 CALL -662 : rem call GETLN >120 for i = 512 to 767 >130 x=peek(i)-128 :rem get element of buffer >140 BF$=BF$+chr$(x) >150 next i > A more commonly used entry points for this is CALL -657, which is the same as the above GETLN, but without a prompt in the way. It is shown on the Beagle Bros. chart, and other publications. They also look for the RETURN! 10 PRINT "enter name: "; : CALL -657 20 A$="": for x= 512 ti 767: if peek(x) <> 141 then A$=A$+CHR$(peek(x)-128): next x -- ==================================================================== David Robins, M.D. Smith-Kettlewell Eye Research Foundation (previously known as: Smith-Kettlewell Institute of Visual Sciences) 2232 Webster St; San Francisco CA 94115 415/561-1705 (voice) {ihnp4,qantel,dual}!ptsfa!ski!dr The opinions expressed herein do not reflect the opinion of the Institute!