ファイルの終端に達したかどうかを確認する
err=meof(fd)
スカラー: 関数mopen
により返された
fd
パラメータ.
-1 は直近にオープンされたファイルを意味します.
デフォルト値は -1です.
スカラー: エラーインジケータ
関数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"); | ![]() | ![]() |