跳轉到內容

Ada 程式設計/庫/Ada.Strings.Unbounded.Text IO

來自華夏公益教科書,開放書籍,開放世界

Ada. Time-tested, safe and secure.
Ada. 經時間考驗,安全可靠。

Ada.字串.無界.Text_IO 是一個 GNAT 實現定義的包,提供直接在無界字串上工作的 Get_Line 和 Put_Line 函式。它們比標準 Ada.Text_IO 函式更有效率,也更容易使用。

function Get_Line return Unbounded_String;

function Get_Line (File : Ada.Text_IO.File_Type) return Unbounded_String;

讀取到當前行的末尾,並將結果作為適當長度的無界字串返回。如果不存在 File 引數,則從 Current_Input 輸入。

procedure Put      (U    : Unbounded_String); 
procedure Put      (File : Ada.Text_IO.File_Type;  U : Unbounded_String); 
procedure Put_Line (U    : Unbounded_String); 
procedure Put_Line (File : Ada.Text_IO.File_Type;  U : Unbounded_String);

這些等效於傳遞 To_String (U) 值的標準 Text_IO 例程,但執行效率更高,因為避免了對引數的額外複製。

Ada 2005 中,與該包等效的標準包是 Ada.Text_IO.Unbounded_IO.

另請參閱

[編輯 | 編輯原始碼]

華夏公益教科書

[編輯 | 編輯原始碼]

外部示例

[編輯原始碼]

Ada 參考手冊

[編輯 | 編輯原始碼]
華夏公益教科書