Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2018-07

4 Byte Storage - how to map up?

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ozz Nixon

I am trying to access a file written to disk with 2 Singles (4 bytes each, 8 bytes total).

Linux: hexdump -Cv database.dat

00 00 00 81 00 00 00 81

The value saved in C, is 1 for both fields (low record #) and (high record #).

In Pascal, if I do the same write using Longint, I get:

01 00 00 00 01 00 00 00

If I do the same write using Single, I get:

00 00 80 3F 00 00 80 3F

Before I write a mask/swap and only be right part of the time - is there a setting that I need to enable/do so I can read/write C binary and work fine?

Thank you,
Ozz

Reply by email