Article View: alt.lang.basic
Article #668HELP!
From: Ross Hedvicek
Date: Fri, 29 Nov 1996 00:00
Date: Fri, 29 Nov 1996 00:00
109 lines
3319 bytes
3319 bytes
I have a BIG problem, I have to make a chat program that will display the last *ten* quotes said by somebody, and erase the ones before that. It also gives the user the ability to input a line of his own. I know how to do this but my program keeps screwing up every time I run it. The first time I run it, it displays the contents of CHAT.ATX but then along the way if the user inputs a line of his own, the whole CHAT.ATX file is erased, how??? can anybody figure this out?? HELP ME!!!!!!!!!!!!! Ross Hedvicek Jr. The messed up code: start: CLS COLOR 7 LOCATE 6, 5: PRINT "C - Chat" LOCATE 9, 5: PRINT "Q - Quit" LOCATE 11, 4: PRINT "Your Choice?" DO do$ = INKEY$ LOOP WHILE do$ = "" IF do$ = "C" OR do$ = "c" THEN GOTO startchat IF do$ = "Q" OR do$ = "q" THEN END GOTO start ' ' ' startchat: OPEN "CHAT.ATX" FOR INPUT AS #1 CLS : COLOR 4 FOR x = 1 TO EOF(1) INPUT #1, name$, saywhat$ COLOR 7: PRINT name$; " babbled this:" COLOR 4: PRINT saywhat$ IF EOF(1) THEN EXIT FOR NEXT x CLOSE #1 COLOR 7 PRINT PRINT "Add anything? [Y/N]" startq: DO IN$ = INKEY$ LOOP UNTIL NOT IN$ = "" IF IN$ = "Y" OR IN$ = "y" THEN GOTO addchat IF IN$ = "N" OR IN$ = "n" THEN GOTO start GOTO startq ' ' ' addchat: PRINT "What do you want to add? (Max. length 70 characters)" INPUT ; "", add$ add2chat$ = LEFT$(add$, 70) COLOR 4: PRINT : PRINT "Are you sure you want to say:": PRINT add2chat$ PRINT : PRINT "[Y/N]" startdo: DO yn$ = INKEY$ LOOP WHILE yn$ = "" IF yn$ = "Y" OR yn$ = "y" THEN GOTO add2chaty IF yn$ = "N" OR yn$ = "n" THEN GOTO startchat GOTO startdo ' ' ' add2chaty: RESET OPEN "chat.atx" FOR INPUT AS #1 lines# = 0 DO LINE INPUT #1, line$ lines# = lines# + 1 LOOP UNTIL EOF(1) CLOSE #1 OPEN "CHAT.ATX" FOR INPUT AS #1 OPEN "CHAT.1" FOR OUTPUT AS #2 left# = lines# - 9 FOR x = 1 TO left# LINE INPUT #1, skip$ NEXT x FOR x = 1 TO EOF(1) LINE INPUT #1, line$ WRITE #2, line$ NEXT x WRITE #2, yourname$, add2chat$ CLOSE #1, #2 ' ' OPEN "CHAT.1" FOR INPUT AS #1 OPEN "CHAT.ATX" FOR OUTPUT AS #2 FOR x = 1 TO 10 LINE INPUT #1, line$ WRITE #2, line$ IF EOF(1) THEN EXIT FOR NEXT x CLOSE #2, #1 KILL "CHAT.1" ' GOTO start
Technical Details
Message-ID:
<329f48b5.747169@news.cyberstreet.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8e35,f791aa850657c9e7,start X-Google-Attributes: gidf8e35,public X-Google-Thread: 10c949,f791aa850657c9e7,start X-Google-Attributes: gid10c949,public X-Google-Thread: f78f1,f791aa850657c9e7,start X-Google-Attributes: gidf78f1,public X-Google-Thread: f5300,f791aa850657c9e7,start X-Google-Attributes: gidf5300,public X-Google-Thread: 112458,f791aa850657c9e7,start X-Google-Attributes: gid112458,public X-Google-Thread: 100d42,f791aa850657c9e7,start X-Google-Attributes: gid100d42,public X-Google-Thread: 10ab99,f791aa850657c9e7,start X-Google-Attributes: gid10ab99,public X-Google-Thread: 137a74,f791aa850657c9e7,start X-Google-Attributes: gid137a74,public From: naafetee@cyberstreet.net (Ross Hedvicek) Subject: HELP! Date: 1996/11/29 Message-ID: <329f48b5.747169@news.cyberstreet.com> X-Deja-AN: 201454104 organization: LiveNet, Inc. newsgroups: alt.lang.basic,alt.lang.gfa-basic,comp.lang.basic.misc,fido.ger.basic,fj.lang.basic,microsoft.public.basic.dos,microsoft.public.basic.other,relcom.com.lang.basic