Go to: Synopsis. Return value. Related. MEL examples.
feof
<int>
feof is undoable, queryable, and editable.
Returns non-zero if end of file is reached. Note that if an empty file is opened, feof will not detect that it is at the end of the file until at least one read is performed.// 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;