comp.lang.ada
 help / color / mirror / Atom feed
* surprise data from Ada.Sequential_IO
@ 2021-03-22 17:13 John Perry
  2021-03-22 17:40 ` Jeffrey R. Carter
  2021-03-22 17:48 ` Dmitry A. Kazakov
  0 siblings, 2 replies; 8+ messages in thread
From: John Perry @ 2021-03-22 17:13 UTC (permalink / raw)


Hello all

I was using gnat 2020 CE on a Linux machine the other day, and wanted to write out data for three different types T1, T2, T3 to a file. I instantiated a Sequential_IO package for each; call them P1, P2, P3.

The following worked as expected (sorry for the abbreviations but I think it will be clear):

>> P1.Create; P1.Write; P1.Close; P2.Open(Append_File); P2.Write; P2.Close;

However, this:

>> P3.Open(Append_File); P3.Write; P3.Close;

...wrote a few bytes of junk between T2's data and T3's data.

I used a hex editor to check the output file between writes, and there was no junk after P2.Close nor after P3.Open; it always came at the beginning of P3.Write.

I reworked the type definitions so that T3's data was included at the end of T2, and in this case P2.Write wrote the data properly, as desired. However, this is not the sort of permanent solution I'd want.

Has anyone else encountered this? Could this be due to alignment issues? Is there some way to avoid this without putting the data there?

thanks in advance
john perry

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-03-23  9:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 17:13 surprise data from Ada.Sequential_IO John Perry
2021-03-22 17:40 ` Jeffrey R. Carter
2021-03-22 18:14   ` John Perry
2021-03-22 19:41     ` Jeffrey R. Carter
2021-03-22 20:54       ` Niklas Holsti
2021-03-23  9:18         ` Jeffrey R. Carter
2021-03-22 21:25       ` Shark8
2021-03-22 17:48 ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox