This Flush routine is equivalent to the one found in the Text_IO package for example.
The Flush procedure synchronizes the external file with the internal file (by flushing any internal buffers) without closing the file. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-01-06 Pascal Obry <o...@adacore.com> * a-direio.adb, a-direio.ads, a-sequio.adb, a-sequio.ads: Add Flush to Sequential_IO and Direct_IO.
Index: a-direio.adb =================================================================== --- a-direio.adb (revision 244124) +++ a-direio.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -108,6 +108,15 @@ return DIO.End_Of_File (FP (File)); end End_Of_File; + ----------- + -- Flush -- + ----------- + + procedure Flush (File : File_Type) is + begin + FIO.Flush (AP (File)); + end Flush; + ---------- -- Form -- ---------- Index: a-direio.ads =================================================================== --- a-direio.ads (revision 244124) +++ a-direio.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -94,6 +94,8 @@ function Is_Open (File : File_Type) return Boolean; + procedure Flush (File : File_Type); + --------------------------------- -- Input and Output Operations -- --------------------------------- Index: a-sequio.adb =================================================================== --- a-sequio.adb (revision 244124) +++ a-sequio.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -121,6 +121,15 @@ return FIO.End_Of_File (AP (File)); end End_Of_File; + ----------- + -- Flush -- + ----------- + + procedure Flush (File : File_Type) is + begin + FIO.Flush (AP (File)); + end Flush; + ---------- -- Form -- ---------- Index: a-sequio.ads =================================================================== --- a-sequio.ads (revision 244124) +++ a-sequio.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -90,6 +90,8 @@ function Is_Open (File : File_Type) return Boolean; + procedure Flush (File : File_Type); + --------------------------------- -- Input and output operations -- ---------------------------------