Go to: Synopsis. Return value. Related. MEL examples.
fgetline
int
fgetline is NOT undoable, NOT queryable, and NOT editable.
Returns the next line (string of characters followed by a newline) or nothing if end of file is reached.string | Next line |
// Make a sample file to use as a test example // $exampleFileName = ( `internalVar -userTmpDir` + "example.tmp" ); $fileId=`fopen $exampleFileName "w"`; fprint $fileId "Hello there\nMEL user\n"; fclose $fileId; // Now read it back one line at a time // $fileId=`fopen $exampleFileName "r"`; string $nextLine = `fgetline $fileId`; while ( size( $nextLine ) > 0 ) { print ( $nextLine ); $nextLine = `fgetline $fileId`; } fclose $fileId;