mseek sets current position in a binary file Calling Sequence mseek(n [,fd, flag]) Arguments n a scalar: the offset in a number of bytes. fd a scalar: a file descriptor returned by the function mopen. -1 stands for last opened file. Default value is -1. flag a string: specifies the origin. Default value 'set'. Description The function mseek sets the position of the next input or output operation on the stream fd. The new position is at the signed distance given by n bytes from the beginning, from the current position, or from the end of the file, according to the flag value which can be 'set', 'cur' or 'end'. This is the reason why n must be positive when flag is equal to 'set'. mseek allows the file position indicator to be set beyond the end of the existing data in the file. If data is later written at this point, subsequent reads of data in the gap will return zero until data is actually written into the gap. mseek, by itself, does not extend the size of the file. Examples res then write(%io(2),'Bug'); end mseek(0,fd1,'set'); // trying to read more than stored data res1=mget(100,'d',fd1); if res1<>res then write(%io(2),'Bug'); end meof(fd1) mclearerr(fd1) mclose(fd1); ]]> See Also mclose meof mfprintf fprintfMat mfscanf fscanfMat mget mgetstr mopen mprintf mput mputstr mtell mdelete