Put# Statement

將資料條目寫入相對檔案中,或將位元組序列寫入二進制檔案中。

tip

Use Print# statement to print data to a sequential text file. Use Write# statement to write data to a sequential text file with delimiting characters.


Syntax:

Put Statement diagram


Put [#]fileNum, [recordNum|filePos], variable

Parameters:

fileNum: Any integer expression that defines the file that you want to write to.

recordNum, filePos: For relative files (random access files), the number of the record that you want to write.

對於二進制檔案 (二進制存取),是指檔案中開始寫入的位元組位置。

variable: Name of the variable that you want to write to the file.

相對檔案的備註:如果此變數的內容不符合 Open 陳述式的 Len 子句中指定的資料條目之長度,則新寫入的資料條目與下一個資料條目之間的空間會由目標檔案中的現有資料所填補。

二進制檔案的備註:變數的內容會寫入至指定的位置,而檔案指標會直接插入到最後一個位元組後。資料條目之間不留空間。

Example:

Please support us!