Saving RECORDS to File 
Author Message
 Saving RECORDS to File

Ok, I have been working on a few utils for RPGDevelopment, and I got this
quite large Record that contains Data for Monsters.  However, when I try
to save this file to disk, it comes up with a file size of 300k!!!  TOO
BIG FOR JUST 9 MONSTERS WITH JUST RAW INTIGER AND  STRING DATA (No
graphics)!!!!!!

It's setup like this

var monster: array[1..10,1..9] of foe;

the first part of the arrayis the group the monster belongs to, the
second is the monster data 1-9 (9 monsters per group)

When I save just ONE monster it comes to like 30k, Ialways thought that
30k wouldhold all 9 monsters that belong to the group.

When I save it, i use the code

for i := 1 to 9 do
blockwrite(f, monster[currentgroupselected][i], monster[groupselected][i]);

Currentgroupselected and group selected are the same thing.
When I load the file in EDIT.COM each line is 1022 characters across, not
desirable.... HELP!!!!



Wed, 18 Jun 1902 08:00:00 GMT  
 Saving RECORDS to File
Hello !


 > blockwrite(f, monster[currentgroupselected][i], monster[groupselected][i]);

Does "monster[groupselected][i]" = the size of the element
"monster[currentgroupselected][i]" ?

If not, try to use this:

BLOCKWRITE(f,Monster[CurrentGroupSelected][i],
SIZEOF(Monster[CurrentGroupSelected][i]));

and ignore "monster[groupselected][i]".

If you want to look at the blockwriting step-by-step using F4 and F7 in the IDE
you beefit sfrom using a WORD type integer, like this:
VAR
  bw:WORD;

 > blockwrite(f, monster[currentgroupselected][i],
 > monster[groupselected][i],bw);

Put "br" in your watch list, and step through the code. You will see that bw
reflects the amount of bytes written to the file. If you use the IDE help one
BLOCKWRITE you will get to know that it takes 3 -4 parameters:
BLOCKWRITE(a,b,c,d);
a = Filehandle
b = Dataarea
c = Bytes to write
d = Optional variable to store number of bytes written.

BLOCKREAD also supopoorts a 4th parameters to store the amount of bytes read
from the file into dataarea.

Enjoy, I hope you find a solution.

Regards Mikkel Breiler, Cosysop Renoz BBS, Amateur Lego Technic engineer



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Saving records to files

2. Best way to save records onto files

3. Updating saved records in a file!

4. Save records into Excel Files ?

5. Cannot save and read record from the file

6. Saving Case Variant Records in a File

7. Saving Record Information to a Binary File?

8. Saving an edited record as a new record

9. Urgent -- Saving a Turbo Pascal file into .tXt file

10. DB records not saving!

11. Save one record fast/easy!

12. Removing and Saving MS Access Records

 

 
Powered by phpBB® Forum Software