BinaryFile.Seek
---------------

Moves file pointer to new position.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [BinaryFile](component_BinaryFile.md) | [7.3](newinversion73.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "BinaryFile.Seek"; BinaryFileRef; Position ) 

**MBS**( **"BinaryFile.Seek";** /\* Moves file pointer to new position. \*/  
**$BinaryFileRef**; /\* The reference number for the open file.e.g. $FH \*/   
**$Position**) /\* The new position in the file.e.g. 123 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| BinaryFileRef | The reference number for the open file. | $FH |
| Position | The new position in the file. | 123 |

### Result

Returns OK or error.

### Description

Moves file pointer to new position.  
### Examples

Play with Seek:

 Set Variable \[ $fh ; Value: MBS ( "[BinaryFile.Open](BinaryFileOpen.md)"; "/Users/cs/Desktop/test.txt" ) \]   
\# Query length   
Set Variable \[ $len ; Value: MBS ( "[BinaryFile.Length](BinaryFileLength.md)"; $fh ) \]   
\# move current position   
Set Variable \[ $r ; Value: MBS ( "BinaryFile.Seek"; $fh ; 6) \]   
\# query current position   
Set Variable \[ $pos ; Value: MBS ( "[BinaryFile.Position](BinaryFilePosition.md)"; $fh ) \]   
\# read 5 bytes   
Set Variable \[ $text ; Value: MBS ( "[BinaryFile.ReadText](BinaryFileReadText.md)"; $fh ; 5; "UTF8") \]   
Set Variable \[ $r ; Value: MBS ( "[BinaryFile.Close](BinaryFileClose.md)"; $fh ) \]  
### See also

- [BinaryFile.Close](BinaryFileClose.md)
- [BinaryFile.EOF](BinaryFileEOF.md)
- [BinaryFile.Length](BinaryFileLength.md)
- [BinaryFile.List](BinaryFileList.md)
- [BinaryFile.Open](BinaryFileOpen.md)
- [BinaryFile.Position](BinaryFilePosition.md)
- [BinaryFile.ReadText](BinaryFileReadText.md)

### Blog Entries

- [MBS Plugin Advent calendar: 3 - BinaryFile](https://www.mbsplugins.de/archive/2023-12-03/MBS_Plugin_Advent_calendar_3_-/monkeybreadsoftware_blog_filemaker)
- [FileMaker 18 File Script Steps vs. BinaryFile functions](https://www.mbsplugins.de/archive/2019-06-03/FileMaker_18_File_Script_Steps/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 12nd June 2017 , last changed 12nd June 2017

  
[BinaryFile.ReadText](BinaryFileReadText.md) - [BinaryFile.WriteByte](BinaryFileWriteByte.md)

[HTML Version](BinaryFileSeek.shtml)