# File.Trunc() Method
> Version: _Available or changed with runtime version 1.0._
Truncate an ASCII or binary file to the current position of the file pointer.
> NOTE
> This method is supported only in Business Central on-premises.
## Syntax
```al
 File.Trunc()
```
> NOTE
> This method can be invoked without specifying the data type name.
## Parameters
File
Type: file-data-type
An instance of the file-data-type data type.
## Remarks
Typically, you use this method together with file-seek-method. Use File.Seek to position the pointer in the file and then use File.Trunc to truncate the file at that point.
## Example
The following example sets a pointer at position 20 in a file and truncates the file at the pointer position. The file-writemode-method allows the file that is named C:\\TestFolder\\TestFile.txt to open in write mode. The Seek method sets a pointer at position 20 in the file and then the file-trunc-method truncates the contents at the pointer position. This example assumes that you have created a text file named C:\\TestFolder\\TestFile.txt. The file is then saved a truncated file.
```al
 var
    TestFile: File;
begin
    TestFile.WriteMode(True);
    TestFile.Open('C:\TestFolder\TestFile.txt');
    TestFile.Seek(20);
    TestFile.Trunc;
end;

```
## Related information
file-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/file/file-trunc-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/file/file-trunc-method/
