跳轉到內容

BlitzMax/模組/系統/StandardIO

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

BlitzMax StandardIO 模組包含用於將文字讀寫到標準 IO(輸入/輸出)流的命令。

標準 IO 流通常連線到“控制檯”,允許您以非常簡單的方式與應用程式互動。

全域性變數

[編輯 | 編輯原始碼]

StandardIOStream

[編輯 | 編輯原始碼]

Global StandardIOStream:TStream=TTextStream.Create( New TCStandardIO,TTextStream.UTF8 )

描述: 用於 Print 和 Input 的 BlitzMax 流物件

資訊: PrintInput 命令可以透過將 StandardIOStream 全域性變數設定為替代流物件來重定向。

Function Print( str$="" )

描述: 將字串寫入標準 IO 流

資訊: 在 str 之後也寫入一個換行符。

示例:

Rem
Use the Print command to output BlitzMax strings to the Console window.
End Rem

Print "Hello World"

Function Input$( prompt$=">" )

描述: 從標準 IO 流接收一行文字

資訊: 可選的 prompt 在返回輸入之前顯示。

示例:

Rem
Use the Input command to read user input from the console to a BlitzMax String.
End Rem

name$=Input("What is your name")
print "Hello "+name
華夏公益教科書