Posts: 37
Threads: 4
Joined: Feb 2005
Yeah Meg its make much more sense.
Here is a look at what i have done so far to the new delvid.
SUB delvid
DIM vid AS videotype
CLS
DO UNTIL response$ = "n"
INPUT "Please enter video's bar code number", number
vid.id = number
OPEN "vid.id" FOR RANDOM AS #1 LEN = LEN(vid)
GET #1, vid.id, vid
CLOSE #1
PRINT "This is the video's name", vid.vidname
PRINT "This is the video's main actor", vid.vidactor
PRINT "This is the video's rating", vid.vidratin
PRINT "This is the video's genre", vid.vidgenre
INPUT "Do you wish to delete the above data?", responset$
If responset$ = "y" then
Okay now is this going in a correct way??
And where/when should i begin setting the elements to the blank strings?
I was thinking bout
If responset$ = "y" Then
(set the records to blank strings)
(tell user that the data has been deleted)
(prompt user to deleter other records)
ill Gates time is almost up.... i am taking over
Posts: 480
Threads: 24
Joined: Mar 2003
Close. First of all in the OPEN command, the thing that goes in the quotes is the FILENAME:
OPEN "name of file goes here" FOR RANDOM AS #1 LEN = LEN(Vid)
so if you want the file on your hard drive to be called "video.dat" or something, put that in the quotes.
secondly, to overwrite a record in the file, do this:
vid.vidname = ""
vid.vidactor = ""
etc.. set all the stuff to blank strings (except vid.id)
Then, after you've cleared it out, you need to PUT it back into the file (in the same box)
PUT #1, Vid.id, Vid
*peace*
Meg.
Posts: 37
Threads: 4
Joined: Feb 2005
MARRY ME MEG!!!
Okay thanks a lot!!!!
Here is my code:
SUB delvid
DIM vid AS videotype
CLS
DO UNTIL response$ = "n"
INPUT "Please enter video's bar code number", number
vid.id = number
OPEN "vid.id" FOR RANDOM AS #1 LEN = LEN(vid)
GET #1, vid.id, vid
PRINT "This is the video's name", vidname.vid
PRINT "This is the video's main actor", vidactor.vid
PRINT "This is the video's rating", vidratin.vid
PRINT "This is the video's genre", vidgenre.vid
INPUT "do you wish to delete the record?y/n", responset$
IF responset$ = "y" THEN
vid.vidname = ""
vid.vidactor = ""
vid.vidratin = ""
vid.vidgenre = ""
PUT #1, vid.id, vid
ELSE
PRINT "You cancelled the delete"
END IF
INPUT "do you want to delete any other records?", response$
LOOP
CLOSE #1
END SUB
___________________
I tested it, i added to files and i delted one. When i searched for it it was not there. Wooo.
One error however, when it is deleting, they say
This is the video's name 0
This is the video's main actor 0
Blah Blah.
But it still deletes JUST THE USER DOES NOT KNOW WHAT HE DELETING.
ill Gates time is almost up.... i am taking over
Posts: 480
Threads: 24
Joined: Mar 2003
You still have "vid.id" in the quotes in your OPEN command. Is "vid.id" the name of the file on your hard disk? in otherwords, is this the SAME filename that you are using in all your other SUBs ?
I recommend naming the file something like "videos.dat"
Every OPEN command in your entire program should be opening the same file.
Also, you are OPENing *inside* your loop, but CLOSEing *outside* your loop. This will cause an error if the person tries to delete another video (because it will try to OPEN a file that has not yet been CLOSEd). Move the OPEN statement before the DO loop.
*peace*
Meg.
Posts: 37
Threads: 4
Joined: Feb 2005
Hey it works now. Check it out:
SUB delvid
DIM vid AS videotype
CLS
DO UNTIL response$ = "n"
INPUT "please enter video's bar code number", number
vid.id = number
OPEN "vid.id" FOR RANDOM AS #1 LEN = LEN(vid)
GET #1, vid.id, vid
PRINT "This is the video's name", vid.vidname
PRINT "this is the video's genre", vid.vidgenre
PRINT " this is the video's main actor", vid.vidactor
PRINT "this is the video's rating", vid.vidratin
INPUT "do you wish to delete the record?y/n", responset$
IF responset$ = "y" THEN
vid.vidname = ""
vid.vidactor = ""
vid.vidratin = ""
vid.vidgenre = ""
PUT #1, vid.id, vid
ELSE
PRINT "You cancelled the delete"
END IF
INPUT "do you want to delete any other records?", response$
LOOP
CLOSE #1
END SUB
Okay it works totally good. Thanks again Meg.
Now Meg i am going to need your full help (everyone can help too). I got Friday and Saturday to finish off this program. It is due Sunday or Monday. So i need you to help me figure out how to edit and list all videos. Because i have no knowledge whatsoever of complex Q-Basic.
For the other subs, say:
I got
1- Batman
2- Superman
3- Spiderman
The list i think i gotta find a way to open all the id numbers and list all their information. Any special statements i may need to know on this sub?
Basic Structure
1. I must first open all the files that are stored
2. I must list all the files.
Do i gotta list everything such as the
Name, Rating, Actor, Genre.
Or just name?
ill Gates time is almost up.... i am taking over
Posts: 480
Threads: 24
Joined: Mar 2003
please post the entire code, including all SUBs. I am still very concerned about your use of "vid.id" for the filename in your OPEN commend...
Also, you *still* have the OPEN command *inside* your loop, but the CLOSE command *outside* the loop. This will error if the loop tries to run more than once...
*peace*
Meg.
Posts: 37
Threads: 4
Joined: Feb 2005
I got the list sub to work now, the vid.id is working fine because for some reson the vid.bas function is not responding the way i want it to. The reason why i used vid.id is because the user will store information in the id number. when the user searches for the records he has to enter the id number and will retrieve all the information stored in the id number. understand?
About the list all subs, could you give me some tips?
ps my programme although there are some errors, works fine.
I will post the code as soon as i'm finished with the last sub.
ill Gates time is almost up.... i am taking over
Posts: 2,404
Threads: 153
Joined: Jan 2005
Quote:ps my programme although there are some errors, works fine.
:normal: Um, dude, thats the first step to becoming a lazy (aka bad programer) You need to say on game and rout out every bug to get great reveiws on your game or app... Glithes happen, but bugs almost always can be gotten out with time..
So next time, if there are bugs, its not working fine.. besides, FINE means:
Freaked out Insurcure Nerotic & Emotional
Just saying.. good luck with that last sub & your program. :wink:
Kevin ( x.t.r.GRAPHICS)
Posts: 480
Threads: 24
Joined: Mar 2003
So you are naming the file--the one that stores all of your video data on the hard drive-- "Vid.id" ?
I don't recommend that. Sure, it will work.. but why give your file the same name as one of your record elements? It's confusing :p
Anyway, on to your question: How to list the videos in the file. I covered that already in a prior post. To reiterate:
1. OPEN the file.
2. DO until EOF(1)
3. advance to the next record, and GET the record from the file
4. IF the record is non-blank, display it
5. LOOP
6. CLOSE the file
*peace*
Meg.
Posts: 37
Threads: 4
Joined: Feb 2005
Quote:SnakeZ Wrote:ps my programme although there are some errors, works fine.
:normal: Um, dude, thats the first step to becoming a lazy (aka bad programer) You need to say on game and rout out every bug to get great reveiws on your game or app... Glithes happen, but bugs almost always can be gotten out with time..
So next time, if there are bugs, its not working fine.. besides, FINE means:
Freaked out Insurcure Nerotic & Emotional
Just saying.. good luck with that last sub & your program. :wink:
Um.. dude, i kinda of stated it wrong. What i meant was that i keep getting errors using the .dat statement in the OPEN statement. So what i did was tak an alternative route and stored stuff in the .id statement Because i got no errors using the .id statement.
Meg, tomorrow i'll try the program and tell you how it works out.
thanks again.
ill Gates time is almost up.... i am taking over
|