03-13-2005, 06:32 AM
I do not believe that the teacher would tell you that you *had* to make an unstable structure. It simply doesn't work. Look:
If the loop runs more than 1 time, the OPEN command is going to be called twice before the CLOSE command is called. This will halt your program.
This works.
So does this.
Does this make sense? YOUR PROGRAM WILL NOT WORK the way you have it coded. You *must* -- in both your deletevid and editvid SUBs -- either move the OPEN command above the DO command, or move the CLOSE command above the LOOP command. Otherwise, if you type "y" when it asks if you wanna delete or edit another video, your program will crash.
If you are putting a DIM statement in your subs, get rid of the DIM Vid statement that is *not* in your subs (the one directly under the TYPE block).
You Addvid sub is fine. Your delete vid and edit vid subs WILL be fine, once you make the change i highlighted in bold above. Your searchvid has one problem:
Inside the loop, you OPEN file, GET from it, then CLOSE it. But outside the loop (after the LOOP command), you have another CLOSE statement. The file was already closed inside the loop, though. Get rid of the CLOSE command that follows the LOOP command in your searchvid SUB.
*peace*
Meg.
Code:
DO
OPEN file
LOOP
CLOSE FILE
If the loop runs more than 1 time, the OPEN command is going to be called twice before the CLOSE command is called. This will halt your program.
Code:
DO
OPEN file
CLOSE file
LOOP
This works.
Code:
OPEN file
DO
LOOP
CLOSE file
So does this.
Does this make sense? YOUR PROGRAM WILL NOT WORK the way you have it coded. You *must* -- in both your deletevid and editvid SUBs -- either move the OPEN command above the DO command, or move the CLOSE command above the LOOP command. Otherwise, if you type "y" when it asks if you wanna delete or edit another video, your program will crash.
If you are putting a DIM statement in your subs, get rid of the DIM Vid statement that is *not* in your subs (the one directly under the TYPE block).
You Addvid sub is fine. Your delete vid and edit vid subs WILL be fine, once you make the change i highlighted in bold above. Your searchvid has one problem:
Inside the loop, you OPEN file, GET from it, then CLOSE it. But outside the loop (after the LOOP command), you have another CLOSE statement. The file was already closed inside the loop, though. Get rid of the CLOSE command that follows the LOOP command in your searchvid SUB.
*peace*
Meg.