Go to: Synopsis. Return value. Related. MEL examples.

Synopsis

frewind int

frewind is NOT undoable, NOT queryable, and NOT editable.

Rewind the file to the first byte.

Return value

int

Related

fclose, feof, fflush, fgetline, fgetword, fopen, fprint, fread, fwrite, pclose, popen

MEL examples

// Make a sample file to use as a test example
//
$exampleFileName = ( `internalVar -userTmpDir` + "example.tmp" );
$fileId=`fopen $exampleFileName "w"`;
fprint $fileId "Hello there\n";
fclose $fileId;

// Read the first word out of the file, then rewind and read it again
//
$fileId=`fopen $exampleFileName "r"`;
print ( `fgetword $fileId` + "\n" );
frewind $fileId;
print ( `fgetword $fileId` + "\n" );
fclose $fileId;