Solved

Binary Error Record

Posted on 1997-05-05
1
149 Views
Last Modified: 2010-04-06
When runnning the Linklst2.dpr, why does Delphi 1.0 create such a big binary record file eg: the binary file size is
LINKEXP .DTA   51,282 .a.. 02-05-97  7:14:10 pm
from such a small bunch of records (100 records), when using all your default settings in the link list demo?

After making a copy of the above program, I changed the total records to 3000 and the binary file size blew out to >1.5M in size.

Whats happening and why?

How can I limit the binary file to its logical smallest size?

*******************

const
  Max = 100; {max records for text file, therefore max linked list size}

Record Structure

type
  PMyNode = ^TMyNode;
  TMyNode = record
    Name  : String;
    Flight: integer;
    Day   : String;
    Next  : PMyNode;  {Used to link each field}
  end;

sample of the write procedure

procedure TDataForm.CreateNewFile;
var
  F: File of TMyNode;
  Head: PMyNode;
begin
  Head := FirstNode;
  System.Assign(F, FileName);
  ReWrite(F);
  while Head^.Next <> nil do begin
    System.Write(F, Head^);
    Head := Head^.Next;
  end;
  Write(F, Head^);
  System.Close(F);
end;


*******************

sample dump of the LINKEXP .DTA when viewed from within xtree, showing other data that is most likely not directly related to the record structure but added by delphi.

 009640   ·tkUnknown·tkInteger·tkChar·tkEnumeration·tkFloat·tkString·tkSet
 009680   ·tkClass·tkMethod··TTypeKinds·······TOrdType··············otL··S
 0096C0   aturdayte·otSWord·otUWord·otSLong··TFloatType··············ftSin
 009700   gle·ftDouble·ftExtended·ftComp·ftReal··TMethodKind··············
 009740   mkProcedure·mkFunction··TPropInfoProc····PropInfo·PPropInfoU···~
 009780   ·&·]····A·······U···~·1·&·]·&·y·&·]··y··N···&···y···········U·\·
 0097C0   ·G·Sam771··\··p··\··P··p·BR··8·t··p·Ju·X·····WV····FG··&2·$·u·Iu
 009800   ·^_u·X)·······U·····~·&······v··\····p··\··P···t··x··]····9·t···
 009840   ·y·Ju··t·····u·1···#WV·u··~···0·FG·<&2=···u·Iu·^_u··········U···

0
Comment
Question by:Darryl050597
1 Comment
 
LVL 3

Accepted Solution

by:
sperling earned 100 total points
ID: 1335915
A string is 256 bytes, therefore your record is 514 bytes.

100*514

Use e.g. string[20] in your record declaration.


Regards,

Erik.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now