07-28-2003, 06:41 AM
I'm trying to make a random file but I'm not sure how to figure the length and packed length of each data.
Random File/Packed length
|
07-28-2003, 06:41 AM
I'm trying to make a random file but I'm not sure how to figure the length and packed length of each data.
07-28-2003, 11:49 AM
Packed length?
dim record as recordtype Recordnum=lof(1)\len(record)
07-29-2003, 04:20 AM
I don't understand that. What I mean is that when I open a random file I have to specify how large it is, depending on the data. How do I figure the packed length and length of each data.
07-29-2003, 10:45 AM
I have just answered your question. That is, assuming I understand it. ;*)
Okay let's says you have a random file that you already have opened... You certainly would want to use types here. Say you have a type: Code: type recordtype now you want to dimension a record as that type... Code: Dim record as recordtype Lof(1) gets the length of file in bytes so you have to get the length of the record to get the number of records... Code: Numrec=Lof(1)\Len(record) so LOF(1) returns the (L)ength (O)f (F)ile. ;*)
07-29-2003, 11:02 AM
The only way I know how to create a random file is by this:
Code: FILEOPEN: An example but I don't know how they figured out the length of each data.
07-29-2003, 11:09 AM
Geez, that don't even look like QBasic!
I suggest you read the QBasic help more thoroughly (try clicking on the "QBOHO" link above, because it looks suspiciously like you're barking up the wrong tree
07-29-2003, 11:18 AM
DValan: That's the old way of doing random access files. Types simplifies things. ;*)
07-29-2003, 11:19 AM
Hmm it's copied right out of my Qbasic teach yourself book. It was written like 10 years ago though.
|
« Next Oldest | Next Newest »
|