Put# Statement

相対編成ファイルへの 1 つのレコードの書き込みおよび、バイナリファイルへの 1 つのバイトシーケンスの書き込みが行えます。

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:

ご支援をお願いします!