Eh... I need helpby 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 |
| Response Title | Author and Date |
| You need to use a counter variable | Solitaire on Dec 2 |
| Thank you | Zack on Dec 2 |
| Hey | Zack on Dec 3 |
| * Post your code. | Solitaire on Dec 3 |
| EOF in a loop | Clippy on Dec 3 |
| EOF sample: | Solitaire on Dec 3 |
| Ok | Zack on Dec 3 |
| counting | on Dec 6 |
| OK | UnseenMachine 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 feature | Ben on Dec 6 |
| I've mentioned this to Galleon | on Dec 6 |