Ada 程式設計/庫/Ada.Storage_IO
外觀
此語言功能從 Ada 95 開始可用。
Ada.Storage_IO 是 預定義語言環境 自 Ada 95 以來的一部分。
Ada.Storage_IO 不是通用的 輸入/輸出 包。根據 A.9: 泛型包 Storage_IO [註釋](1),它被設計用於構建使用者定義的輸入輸出包,但也可用於將元素從一個 任務 傳輸到另一個任務。注意: 語言定義的任何 IO 包都不是任務安全的。
它允許您將 *一個* 元素儲存在記憶體緩衝區中。該元素需要是 確定子型別。
小心: 當讀取的值無法解釋為子型別 Element_Type 的值時,不一定呼叫異常 Data_Error(您必須按照 RM 中給出的多個引用來遵循 A.13: 輸入輸出中的異常 [註釋]),這可能導致錯誤執行; 尤其是在從未寫入值的情況下可能會發生這種情況。在不確定時使用 'Valid 屬性。
-- Standard Ada library specification -- For copyright, see -- http://ada-auth.org/standards/rm12_w_tc1/html/RM-TTL.html -- -------------------------------------------------------------------------withAda.IO_Exceptions;withSystem.Storage_Elements;generictypeElement_Typeisprivate;packageAda.Storage_IOispragmaPreelaborate (Storage_IO); Buffer_Size :constantSystem.Storage_Elements.Storage_Count := implementation_defined;subtypeBuffer_TypeisSystem.Storage_Elements.Storage_Array (1 .. Buffer_Size); -- Input and output operationsprocedureRead (Buffer :inBuffer_Type; Item :outElement_Type);procedureWrite (Buffer :outBuffer_Type; Item :inElement_Type); -- Exceptions Data_Error :exceptionrenamesIO_Exceptions.Data_Error;endAda.Storage_IO;
外部示例
[編輯原始碼]- 在以下網站搜尋 示例:
Ada.Storage_IO: Rosetta Code,GitHub (片段),任何 Alire 包 或 本華夏公益教科書。 - 在以下網站搜尋與
Ada.Storage_IO相關的 帖子: Stack Overflow,comp.lang.ada 或 任何 Ada 相關頁面。
FSF GNAT
- 規範: a-storio.ads
- 主體: a-storio.adb
drake
