The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.
TEXTMODE Method (File)
Sets whether a file should be opened as an ASCII file or a binary file. Gets the current setting of this option for a file.
[IsTextmode := File.TEXTMODE([SetTextmode])
Specifies the file.
Specifies the mode in which the file will be opened when File.OPEN is called.
If SetTextmode is true, the file will be opened as an ASCII file. If SetTextmode is false, the file will be opened as a binary file.
Property Value/Return Value
The current setting of this option for the file.
true if the file will be opened as an ASCII file; otherwise, false if the file will be opened as a binary file.
This method should be used before File.OPEN is used to open the file. If you use this method on a file that is already open, then an error occurs.
The following example sets the TEXTMODE to true when the file is open for writing. This means the file contents will be written to a text file that is named 'C:\TestFolder\TestFile.txt' by using ASCII characters. The WRITEMODE Method (File) and the OPEN Method (File) open the file for writing and the text ‘Hello World’ is written. The CLOSE Method (File) closes the file after the file is written to. This example requires that you create the following global variable. This example assumes that you have created a text file that is named C:\TestFolder\TestFile.txt.
TestFile.TEXTMODE(TRUE); TestFile.WRITEMODE(TRUE); TestFile.OPEN('C:\TestFolder\TestFile.txt'); TestFile.WRITE('Hello World'); TestFile.CLOSE;