I guess you are using VB3 or a 16-bit version of VB.  If that is the case,
then the variable sizes are:

boolean - 2 bytes (-1 = true, 0 = false)
integer - 2 bytes
string * n - fixed length strings of n bytes

total = 45 bytes

In BP7:

Boolean - not quite sure about the size in BP7, but in D1 I think it is 1
byte (0 - false, 1 = true)
Integer - 2 bytes
sring[n] - 1 byte for string length, plus fixes n-bytes for string data

total = 46 bytes.

Use array of Char instead of string and you might need to use integer
instead of boolean.

HTH,
Dennis.

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Friday, October 18, 2002 10:08 AM
Subject: [DUG]: Strange RECORD behaviour


> I have been playing around with writing a random file in VisualBasic which
> works OK, then thought I would use BP 7 to access this random file and so
> created a record which I thought would be identical.
>
> I was getting garbage with the Pascal program so...
>
> When I look at the size of each, the BASIC version is 45 bytes and the
> Pascal Version is 46 !!??
>
> VB ... size is 45
> Type People
>   InUse as Boolean
>   RecPos as Integer
>   Tag as Integer
>   Total as Integer
>   ID as Integer
>   FirstName as String * 15
>   LastName as String * 20
> end Type
>
> Pascal  ... size is 46
> Person = Record
>   InUse        : Boolean;
>   RecPos     : Integer;
>   Tag           : Integer;
>   Total         : Integer;
>   ID             : Integer;
>   FirstName : String[15];
>   LastName : String[20];
> end;
>
> where is the problem? What is the solution?
>
>
> Laurie..
>
>
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to