0
votes

I have an old program that write some pascal record into file :

type
  Character = Record
    Name : String[50];
    Age : integer;
  end;

begin
  // [..] data contain a Character record
  AssignFile(f, data); // example
  Write(f, data); // example
  CloseFile(f) // example
end.

Is it possible to open this file and read record from another language like C, C++, Go ?

Thank you.

1
Yes, it's possible. - zed
It is possible; however, you will need to know what the size of an integer is for your Pascal compiler (presumably Delphi, from the tags you've given the question). - Jeff Zeitlin
do you have some keywords that can help me for my research ? - Moarz
The size of a Delphi Integer is 32 bits. (IIRC, that has been the case since Delphi 2, released in 1996. The size is 32 bits in both 32-bit and 64-bit applications.) - Andreas Rejbrand
And then there is packing.The first field is 51 bytes, so the second 2-byte field will be on an odd address without padding. - Marco van de Voort

1 Answers

0
votes

Yes, it is.

You simply get a file with characters and integers. It would be easy to read this file using almost any mainstream programming language.

But of course, the precise code will vary from language to language.

In theory, I could add example code reading such a file in the 100 most common programming languages, but then this answer would become too long.