---
title: "getFilePos"
canonical: "https://help.vicon.com/space/Shogun112/31228056/getFilePos"
format: markdown
---
# Description

Gets the current file position

Use this command to get how far you are into a file. The value is in bytes and you can use the file position value to "point" to other parts of the file. This command only makes sense in files opened in binary mode.

## Functional area

Disk I/O

# Command syntax

## Syntax

|  |
| --- |
| `getFilePos fileID` |

### Arguments

| **Name** | **Type** | **Required** | **Comments** |
| --- | --- | --- | --- |
| `fileID` | int | yes | The fileID is usually a variable created earlier in the script with the [fileOpen](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31229157) command |

### Flags

None

## Return value

integer

> Macro (scroll-pagebreak)

## Examples

```plaintext
int $fileID; 
int $filePos;
string $str = "}";
$fileID = `fileOpen "C:/testfile.log" "w"`;
 
//set the file position to the 27th position...
setFilePos $fileID 27;
 
// get the file position and print it out to the command log and 
// the 27th space in the text file.
$filePos = `getFilePos $fileID`;
writeInt $fileID $filePos;
 
//close the file.
fileClose $fileID;
 
// now if you open "C:/testfile.log" you should see "27" in the 
// 27th space counting from 0.
```

# Additional information

## Related commands

- [setFilePos](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31231338)