Eh... I need help

by Zack (no login)

Hi, I was taking a break from my main program and decided to make a simple program that I though would be fun to watch run. Little did I know it would now be that easy e-e. I was trying to make a program that counts indefinitely. I tried:

DO
ON ERROR GOTO BEGINA
OPEN "thecount.txt" FOR INPUT AS #1
INPUT #1, A
CLOSE #1
BEGINA:
PRINT ": ", A + 1
OPEN "thecount.txt" FOR OUTPUT AS #1
WRITE #1, A
CLOSE #1
LOOP WHILE INKEYS$ = ""
'But this just gave me a bunch of 1s'

-

A = 0
DO
PRINT ": ", A + 1
LOOP
'This also gave me a bunch of 1s'

-

DO
ON ERROR GOTO BEGINA
OPEN "thecount.txt" FOR INPUT AS #1
INPUT #1, B
CLOSE #1
B = A + 1
BEGINA:
PRINT ": ", A + 1
A + 1 = B
OPEN "thecount.txt" FOR OUTPUT AS #1
WRITE #1, B
CLOSE #1
LOOP WHILE INKEYS$ = ""
'This wouldn't let me set that variable; A + 1 = B'

-

DO
ON ERROR GOTO BEGINA
OPEN "thecount.txt" FOR INPUT AS #1
INPUT #1, A
CLOSE #1
BEGINA:
WAIT 1
PRINT ": ", A + 1
OPEN "thecount.txt" FOR OUTPUT AS #1
WRITE #1, A
CLOSE #1
WAIT 1
LOOP WHILE INKEYS$ = ""
'This is the closest I got so far. It gives me an error that says'
'Line:9 File alreadyopen'
'Line:10 Bad file mode'
'Line:4 Input past end of file'

-

Does anyone know how to make something like this work? If so please respond. In the meanwhile, I will continue to try new variations. Thank you so much.
-Zack

Posted on Dec 2, 2010, 6:36 PM

Respond to this message   

Return to Index


Response TitleAuthor and Date
You need to use a counter variableSolitaire on Dec 2
 Thank youZack on Dec 2
  HeyZack on Dec 3
   * Post your code.Solitaire on Dec 3
   EOF in a loopClippy on Dec 3
   EOF sample:Solitaire on Dec 3
    OkZack on Dec 3
counting on Dec 6
 OKUnseenMachine on Dec 6
  Interesting thing about integers in QB64... on Dec 6
   Me too Bob, it just don't feel right AND...Clippy on Dec 6
   I think it's a good featureBen on Dec 6
   I've mentioned this to Galleon on Dec 6