Results 1 to 6 of 6

Thread: Random File Access... [RESOLVED]

  1. #1

    Thread Starter
    Addicted Member Max_aka_NOBODY's Avatar
    Join Date
    Jul 2004
    Location
    Amman, Jordan
    Posts
    179

    Resolved 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.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Random File Access - fixed length?

    Quote 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.

  3. #3
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176

    Re: Random File Access - fixed length?

    You could use chunks of a fixed size e,g

    VB Code:
    1. Type Jelly
    2.     Flavour as string * 10
    3.     Colour as string * 10
    4.     State as long
    5.     Spare as string * 100
    6. end type
    7.  
    8. Type JellyBean
    9.     Flavour as string * 10
    10.    Colour as string * 10
    11.    Spare as string * 104 '  A Long is 4 bytes so to make equel length we add it to the spare string
    12. end type

    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  4. #4

    Thread Starter
    Addicted Member Max_aka_NOBODY's Avatar
    Join Date
    Jul 2004
    Location
    Amman, Jordan
    Posts
    179

    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...

  5. #5
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176

    Re: Random File Access... [RESOLVED]

    Cant you find out the file format.

    Whats the file format can you tell us?
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  6. #6

    Thread Starter
    Addicted Member Max_aka_NOBODY's Avatar
    Join Date
    Jul 2004
    Location
    Amman, Jordan
    Posts
    179

    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
  •  



Click Here to Expand Forum to Full Width