comp.lang.ada
 help / color / mirror / Atom feed
* How To Write A Record To File ?
@ 2017-12-08 16:04 patrick
  2017-12-08 16:25 ` AdaMagica
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: patrick @ 2017-12-08 16:04 UTC (permalink / raw)


Hi Everyone

Silly question here.

I snagged this from an old book:


       with sequential_io ;
       procedure compute_total_population is
        package si is        new sequential_io(integer);
        data_file          : si.file_type ;
        result_file        : si.file_type ;
        value              : integer ;
        total              : integer := 0 ;

       begin 

        si.open(data_file, si.in_file, "census74") ;
        while not si.end_of_file(data_file)
         loop
          si.read(data_file, value) ;
          total := total + value ;
         end loop ;

        si.close(data_file) ;

        si.create(result_file, name => "total74") ;
        si.write(result_file, total);
        si.close(result_file) ;

       end compute_total_population ;

sequential_io is a generic package but I can't get it to work with a type that is a record I created.

Is there a way to do this, perhaps another library?

Thanks for reading-Patrick


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

end of thread, other threads:[~2017-12-09 14:38 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-08 16:04 How To Write A Record To File ? patrick
2017-12-08 16:25 ` AdaMagica
2017-12-08 16:40   ` patrick
2017-12-08 16:41   ` patrick
2017-12-08 16:57     ` Anh Vo
2017-12-08 17:11       ` Anh Vo
2017-12-08 17:29         ` patrick
2017-12-08 16:43 ` Dmitry A. Kazakov
2017-12-08 16:53   ` patrick
2017-12-08 17:35 ` Dennis Lee Bieber
2017-12-08 18:01   ` Simon Wright
2017-12-08 23:06     ` patrick
2017-12-08 23:06       ` Victor Porton
2017-12-08 23:28       ` Simon Wright
2017-12-08 23:31         ` patrick
2017-12-09  8:03           ` Usenet (Was: How To Write A Record To File ?) Jacob Sparre Andersen
2017-12-09  9:08             ` Usenet Simon Wright
2017-12-09 14:38               ` Usenet Björn Lundin
2017-12-09 11:34           ` How To Write A Record To File ? Spiros Bousbouras

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