Created
January 19, 2017 17:58
-
-
Save charlie5/a3855c1ffdcd6cafce1ea87cb671b345 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare | |
File_Size : Ada.Directories.File_Size := Ada.Directories.Size ("your_file"); | |
Record_Bytes : Integer := Your_Record'Size * 8; | |
Num_Records : Integer := File_Size / Record_Bytes; | |
First : Integer := Num_Records - 4 | |
File : ada.streams.stream_io.file_type; | |
Stream : ada.streams.stream_io.Stream_Access; | |
Values : array (1..4) of Your_Record; | |
begin | |
ada.streams.stream_io.open (File, in_File, "your_file"); | |
ada.streams.stream_io.set_Index (File, First * Record_Bytes); | |
Stream := ada.streams.stream_io.stream (File); | |
your_record'Read (Stream, Values (1)); | |
your_record'Read (Stream, Values (2)); | |
your_record'Read (Stream, Values (3)); | |
your_record'Read (Stream, Values (4)); | |
ada.streams.stream_io.close (File); | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not use
Ada.Direct_IO
for this?