<< mseek Files : Input/Output functions save_format >>

Scilab Help >> Files : Input/Output functions > mtell

mtell

ファイル先頭基準でカレントバイトのオフセットを返す

呼び出し手順

mtell([fd])

引数

fd

スカラー: mopen関数により返されたファイル記述子. -1は直近にオープンされたファイルを意味します. デフォルト値は-1です.

説明

関数 mtell は, 名前付きのストリームfdが指すファイルの先頭を基準として カレントのバイトのオフセットを返します.

// バイナリ書き込みでテンポラリファイルをオープン
testFile=TMPDIR + '/testFile.bin';
fd = mopen(testFile,'wb');

mput(42,'d'); // 直近にオープンされたファイルに 42を書き込みます
mtell() // ファイル記述子のカレントの位置, 8を返します

mput(42+2,'d', fd); // オープンされたfdに透過的に42を書き込みます
mtell(fd) // ファイル記述子のカレントの位置, 16を返します

mseek(0, fd); // ファイル先端に戻る
mtell(fd) // 0を返します

mclose(fd);

参照


Report an issue
<< mseek Files : Input/Output functions save_format >>