Go to the first, previous, next, last section, table of contents.


A.8.5 Direct Input-Output Operations

Static Semantics

  1. The operations available for direct input and output are described in this subclause. The exception Status_Error is propagated if any of these operations is attempted for a file that is not open.
  2. procedure Read(File : in File_Type; Item : out Element_Type;
                                        From : in  Positive_Count);
    
    procedure Read(File : in File_Type; Item : out Element_Type);
    
    1. Operates on a file of mode In_File or Inout_File. In the case of the first form, sets the current index of the given file to the index value given by the parameter From. Then (for both forms) returns, in the parameter Item, the value of the element whose position in the given file is specified by the current index of the file; finally, increases the current index by one.
    2. The exception Mode_Error is propagated if the mode of the given file is Out_File. The exception End_Error is propagated if the index to be used exceeds the size of the external file. The exception Data_Error can be propagated if the element read cannot be interpreted as a value of the subtype Element_Type, See section A.13 Exceptions in Input-Output.

  1. procedure Write(File : in File_Type; Item : in Element_Type;
                                         To   : in Positive_Count);
    
    procedure Write(File : in File_Type; Item : in Element_Type);
    
    1. Operates on a file of mode Inout_File or Out_File. In the case of the first form, sets the index of the given file to the index value given by the parameter To. Then (for both forms) gives the value of the parameter Item to the element whose position in the given file is specified by the current index of the file; finally, increases the current index by one.
    2. The exception Mode_Error is propagated if the mode of the given file is In_File. The exception Use_Error is propagated if the capacity of the external file is exceeded.

  1. procedure Set_Index(File : in File_Type; To : in Positive_Count);
    
    1. Operates on a file of any mode. Sets the current index of the given file to the given index value (which may exceed the current size of the file).

  1. function Index(File : in File_Type) return Positive_Count;
    
    1. Operates on a file of any mode. Returns the current index of the given file.

  1. function Size(File : in File_Type) return Count;
    
    1. Operates on a file of any mode. Returns the current size of the external file that is associated with the given file.

  1. function End_Of_File(File : in File_Type) return Boolean;
    
    1. Operates on a file of mode In_File or Inout_File. Returns True if the current index exceeds the size of the external file; otherwise returns False.
    2. The exception Mode_Error is propagated if the mode of the given file is Out_File.

    NOTES

  1. (20) Append_File mode is not supported for the generic package Direct_IO.


Go to the first, previous, next, last section, table of contents.