Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Data files

  1. #11
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Re: Data files

    RE: Dynamic block sizes...

    In traditional file handling using Pascal, no, dynamic block sizes aren't allowed. You have to know exactly the length of the data you are going to store. This obviously precludes the use of long strings. So every string in the records should be of the form string[ x ] (x is in the range 1 to 255). There are of course other things you can't store... dynamic arrays for example.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  2. #12

    Re: Data files

    why are you doing things the 'old' way. I would suggest to look into streams as suggested by Brainer.

    Also have a read on
    http://delphi.about.com/od/fileio/a/fileof_delphi.htm (your 'old' way)
    and
    http://delphi.about.com/od/vclusing/l/aa110803a.htm (streams the 'new' way)

    http://3das.noeska.com - create adventure games without programming

  3. #13
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Re: Data files

    I don't want to get drawn into an argument about which method is best because quite simply the choice of which mechanism you use will be (or more accurately, should be) governed by what you are using it for.

    Streams have their plus sides, namely the ability to stream across different mediums and the relative ease with which they can cope with variable sized records (NOTE: I said relative ease... some things that are a breeze with standard file handling can become a real nightmare with a stream based mechanism).

    Traditional files are simple to use... define the record type, declare a file variable and you're half way there. They can be a pain in the ass when you want to add or remove data from the records you've stored... but then so too can streams.

    I would recommend learning about standard file handling first... you don't have to concern yourself with all the technicalities of the streaming mechanisms (like calculating record byte offsets).

    Ixy:- if you are still having problems with the filehandling, then post your code. Without seeing it, it's hard to know whats going on so we can only guess at possible solutions.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  4. #14

    Re: Data files

    No, I solved my problem.

    But NOW I have the craziest problem ever.
    The program doesn't want to run under XP anymore.
    On my Windows 7 beta it runs fine, but on XP... it just opens and closes fast...

    What the hell?

    EDIT:


    Found the problem. I changed the path for testing purposes and forgot to change it back.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •