Moves the current file mark of the file identified by refnum to the position indicated by pos offset according to the mode in pos mode. This function moves the file mark only when both the pos mode and pos offset inputs of the read or write operation are not wired. If you want to move the file mark while using the Read File and Write File functions, wire the pos mode or pos offset inputs of those functions instead of using the Seek function. Details
![]() |
refnum is the file refnum associated with the file whose file mark you want to move. | ||||||
![]() |
pos mode, together with pos offset, specifies where to set the file mark.
If the computed location does not exist in the file, for example, pos mode is 0 and pos offset is 10, the file mark does not move, no data is read or written, and the function returns an error.
If you wire pos offset, pos mode defaults to 0, and the offset is relative to the beginning of the file. If you do not wire pos offset it defaults to 0, pos mode defaults to 2, and the read or write operation starts at the current file mark.
|
||||||
![]() |
pos offset specifies how far from the location specified by pos mode to set the file mark. If the file specified by refnum is a datalog file, you express pos offset in terms of records of the data type stored in the datalog file. Otherwise, you express pos offset in units of bytes. The default is 0. | ||||||
![]() |
error in describes error conditions that occur before this VI or function runs.
The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurs before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
| ||||||
![]() |
dup refnum returns refnum unedited. | ||||||
![]() |
offset indicates the new location of the current file mark relative to the beginning of the file. offset is expressed in the same terms as pos offset, that is records for datalog files and bytes for byte stream files. | ||||||
![]() |
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces.
Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.
|
Suppose you want to read some data from a binary file that contains 500 bytes of header data followed by raw data, but you want to skip the header data. Before you use the Read File function, pass the file refnum to the Seek function, where pos mode is 0 and pos offset is 500.
If you want to read every other record from a datalog file, read records from the file in a While Loop. In the loop, read one record from the file and pass the file refnum to the Seek function, where pos mode is 2 and pos offset is 2.