Since getting a new computer with 64-bit Windows, I'm trying to convert an old TP6 program to run as 32-bit. I was able to get it to compile with little issue, but it cannot read the data file.
The program is a little gas mileage and similar program I wrote ages ago. I still use it. It stores the data in binary format as a record, which is set as this:
type
alpha = string[8];
b_type = string[11];
menu_line = string[20];
d_type = string[35];
screen_line = string[80];
path_string = PathStr;
char2 = string[2];
gasrec = record
case info_type: char of
'X': (last_acc : word;
start_mile: longint;
fil_size : longint);
'1': (gas_date : word;
odometer : longint;
gas_used : longint;
price_gal : word;
price_paid: longint;
brand : b_type);
'2': (spcl_date : word;
spcl_odom : longint;
spcl_price: longint;
spcl_descr: d_type;
spcl_wrnty: char)
end;
The problem is that it doesn't seem to read it in properly. Looking at the binary data, it looks like the word and longint sizes may not match. I'm not sure how to force word to 16-bit and longint to 32-bit, as it seems to be reading them in as 32-bit and maybe 64-bit?
This is the piece of code that reads the first entry:
with data_info[0] do
begin
last_accessed:=last_acc;
start_mileage:=start_mile;
file_size:=fil_size
end;
This is what the watch on data_info shows:
data_info = {{INFO_TYPE = 88 'X', LAST_ACC = 947, START_MILE = 0, FIL_SIZE = 0, GAS_DATE = 947, ODOMETER = 0, GAS_USE
This is the view of the file:
00000000 58 42 E9 C6 B3 03 00 37 00 00 00 00 00 00 00 00 XB·····7········
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ················
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ················
00000030 31 24 E4 6C BD 03 00 ED 04 00 00 A1 0D 31 11 00 1$·l·········1··
00000040 00 05 53 68 65 6C 6C 00 00 00 00 00 00 00 00 00 ··Shell·········
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ················
00000060 32 3A E4 C0 C3 03 00 4B 45 00 00 17 42 61 74 74 2:·····KE···Batt
00000070 65 72 79 2F 65 6C 65 63 74 72 69 63 61 6C 20 74 ery/electrical t
00000080 65 73 74 00 00 00 00 00 00 00 00 00 00 00 00 20 est············
00000090 31 49 E4 12 C7 03 00 0F 05 00 00 47 0D 30 11 00 1I·········G·0··
000000A0 00 0A 54 68 6F 72 6E 74 6F 6E 27 73 00 00 00 00 ··Thornton's····
000000B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ················
000000C0 31 68 E4 2A D2 03 00 6E 05 00 00 AF 0E 69 14 00 1h·*···n·····i··
000000D0 00 09 54 68 6F 72 6E 74 6F 6E 73 00 00 00 00 00 ··Thorntons·····
000000E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ················
000000F0 31 7E E4 F6 DD 03 00 37 05 00 00 3B 0F 56 14 00 1~·····7···;·V··
00000100 00 05 4D 6F 62 69 6C 00 00 00 00 00 00 00 00 00 ··Mobil·········
00000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ················
00000120 32 98 E4 C2 E9 03 00 00 1F 01 00 21 42 72 61 6B 2··········!Brak
Basically, last_accessed should be $E942 (59714), start_mileage should be $0003B3C6 (242630, which is divided by 10 later in the program to be 24,263.0), and file_size should be $00000037 (55), which means 55 records.