<< mclose Files : Input/Output functions merror >>

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

meof

ファイルの終端に達したかどうかを確認する

呼び出し手順

err=meof(fd)

引数

fd

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

err

スカラー: エラーインジケータ

説明

関数meofは,前の mget または mgetstr のコールにより ファイル終端に達している場合にヌル以外の値を返します. エラーフラグおよびEOFフラグをゼロにリセットするために, 関数mclearerrが使用されます.

// Write a temporary file with some text in it
this_file = pathconvert(TMPDIR+"/mputstr.txt", %F);

fd = mopen(this_file, "wt");
mputstr("Scilab is a numerical computing software.", fd);
mclose(fd);

fd = mopen(this_file,'rt');
i = 0;
while ~meof(fd) do
   mfscanf(1, fd, "%c");
   i = i + 1;
end

mclose(fd);

disp("Scilab has found " + string(i) + " chars in the file");

参照


Report an issue
<< mclose Files : Input/Output functions merror >>