{"title":"File.Seek(Integer) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/file/file-seek-method/","by":"JOP-AL","license":"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-seek-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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/file/file-seek-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Sets a file pointer to a new position in an ASCII or binary file.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"File.Seek(Integer) Method","slug":"fileseekinteger-method","at":0,"chars":1358},{"level":2,"title":"Syntax","slug":"syntax","at":226,"chars":125},{"level":2,"title":"Parameters","slug":"parameters","at":351,"chars":171},{"level":2,"title":"Remarks","slug":"remarks","at":522,"chars":79},{"level":2,"title":"Example","slug":"example","at":601,"chars":625},{"level":2,"title":"Related information","slug":"related-information","at":1226,"chars":132}],"text":"# File.Seek(Integer) Method\n> Version: _Available or changed with runtime version 1.0._\nSets a file pointer to a new position in an ASCII or binary file.\n> NOTE\n> This method is supported only in Business Central on-premises.\n## Syntax\n```al\n File.Seek(Position: Integer)\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\nFile\nType: file-data-type\nAn instance of the file-data-type data type.\nPosition\nType: ../integer/integer-data-type\nThe position at which to set the pointer.\n## Remarks\nThis method is often used with file-pos-method and file-len-method.\n## Example\nThe following example sets a pointer at position 20 in a file and truncates the file at the pointer position. The file-writemode-method enables a file 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 of the file at the pointer position. This example assumes that you have created the text file C:\\\\TestFolder\\\\TestFile.txt.\n```al\n var\n    TestFile: File;\nbegin\n    TestFile.WriteMode(True);\n    TestFile.Open('C:\\TestFolder\\TestFile.txt');\n    TestFile.Seek(20);\n    TestFile.Trunc;\nend;\n\n```\n## Related information\nfile-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}