|
-
Jan 24th, 2005, 02:59 AM
#1
Thread Starter
Addicted Member
Random File Access... [RESOLVED]
Does the record size for random file access have to be fixed? If yes, is there any workaround for this?
Also, is it possible to write\read more than one record type to\from the same file?
If both of those are impossible, are they possible in VB.net?
Thanx in advance.
Last edited by Max_aka_NOBODY; Jan 24th, 2005 at 01:03 PM.
-
Jan 24th, 2005, 03:05 AM
#2
Re: Random File Access - fixed length?
 Originally Posted by Max_aka_NOBODY
Does the record size for random file access have to be fixed? If yes, is there any workaround for this?
Also, is it possible to write\read more than one record type to\from the same file?
If both of those are impossible, are they possible in VB.net?
Thanx in advance.
Yes. You have to make all records the same length. Otherwise, don't use Random access.
You can have a User Defined Type that can be common to different records, that have a variable used to distinguish between records. They must follow the same format, though.
I don't think that VB.Net is any different.
-
Jan 24th, 2005, 05:02 AM
#3
KING BODWAD XXI
Re: Random File Access - fixed length?
You could use chunks of a fixed size e,g
VB Code:
Type Jelly
Flavour as string * 10
Colour as string * 10
State as long
Spare as string * 100
end type
Type JellyBean
Flavour as string * 10
Colour as string * 10
Spare as string * 104 ' A Long is 4 bytes so to make equel length we add it to the spare string
end type
-
Jan 24th, 2005, 01:04 PM
#4
Thread Starter
Addicted Member
Re: Random File Access - fixed length?
Thanx, people, but unfortunately I don't think your approach, Bodwak would be possible in my case. The file format isn't mine, and isn't supposed to be used in VB's Random Access since it has variable record lengths with no padding...
-
Jan 25th, 2005, 03:28 AM
#5
KING BODWAD XXI
Re: Random File Access... [RESOLVED]
Cant you find out the file format.
Whats the file format can you tell us?
-
Jan 25th, 2005, 01:12 PM
#6
Thread Starter
Addicted Member
Re: Random File Access... [RESOLVED]
The format is *.ES*(ESM, ESP, ESS, ESD) - basically data files for an RPG, entirely composed of variable-length records. But now I'm sticking with good ole` binary.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|