Page 1 of 1
what does this mean?!?!
Posted: Mon Feb 07, 2005 1:33 pm
by babygodzilla
hello all. can u help me?
what does the following code do?
Code: Select all
DIM Q(200)
IF popnum = 1 THEN GOSUB open1
.....
open1:
OPEN "R", #1, "onepop.dat", 4
FIELD #1, 4 AS F.pop$:RETURN
all i can see is it opens a file, and then what?
Posted: Mon Feb 07, 2005 2:08 pm
by Mitth'raw'nuruodo
Babygodzilla, hmmm....
Umm...I never seen OPEN used like that, just like this:
OPEN "
location of file" FOR
put OUTPUT, APPEND or INPUT here AS #1
Well I can't help you, but good name though.....GOSUB?
No comment on that PLEASE.
Posted: Mon Feb 07, 2005 2:13 pm
by Guest
i dunno this is from an old old OLD Mac (it's black and white...) and I'm supposed to port it to Flash, cept i dont think this prog works so I have no idea ??? its supposed to do. i think the problem lies within the opening of that file... i dunno...

Posted: Mon Feb 07, 2005 2:14 pm
by babygodzilla
what does "AS #1" do?
as #1... explained
Posted: Mon Feb 07, 2005 3:12 pm
by Agent_Firestalker
it tells qb that you are opening a file and to store that file temporarily as number 1. you can then use #1 instead of the file name.
Agent_Firestalker
Posted: Mon Feb 07, 2005 6:40 pm
by Nodtveidt
What you're looking at is an alternate OPEN technique, a sort of OPEN shorthand. In addition, it's opening the file in a rarely-used-anymore mode called RANDOM. After that, the FIELD statement is used to allocate space for RANDOM-mode data. The 4's are the size, in bytes, of the data requested. It's a very convulted method that's been long replaced with BINARY mode.
Posted: Mon Feb 07, 2005 8:29 pm
by Mitth'raw'nuruodo
Ooohh...So this is the Random-access stuff I keep hearing about?
BTW AS #1 makes that file #1 it like a reference variable for functions to reference later:
For example:
IF EOF(1) = -1 then EXIT DO
will exit a do loop if the position of the file reader is at the end of the file that was opened as #1.
Posted: Wed Feb 09, 2005 1:24 pm
by babygodzilla
Nekrophidius wrote:What you're looking at is an alternate OPEN technique, a sort of OPEN shorthand. In addition, it's opening the file in a rarely-used-anymore mode called RANDOM. After that, the FIELD statement is used to allocate space for RANDOM-mode data. The 4's are the size, in bytes, of the data requested. It's a very convulted method that's been long replaced with BINARY mode.
so, assuming there are values in the file, should that value be saved in F.pop$?
thanks!