feof
int
feof は、取り消し不可能、照会不可能、および編集不可能です。
ファイルの終わりに達すると非ゼロの値を返します。空ファイルを開いている場合、読み出しが少なくとも 1 回行われるまでは、feof はファイルの終わりを検出しないことに注意してください。| int | EOF インディケータ |
// Make a sample file to use as a test example
//
$exampleFileName = ( `internalVar -userTmpDir` + "example.tmp" );
$fileId=`fopen $exampleFileName "w"`;
fprint $fileId "Hello there\nuser";
fclose $fileId;
//
// Now read it back one word at a time, checking for the end of the file
//
$fileId=`fopen $exampleFileName "r"`;
while ( !`feof $fileId` ) {
string $nextWord = `fgetword $fileId`;
if ( size( $nextWord ) > 0 ) {
print ( $nextWord + "\n" );
}
}
fclose $fileId;