|Mac & Win
Reads a text file.
(old name: String.ReadTextFile)
|The native file path. Something like "/Users/cs/desktop/test.txt" on Mac and "C:\Programs\Data\test.txt" on Windows. Files without path end in the root directory on Mac.
|The text encoding for result.
Default is native. This function can also handle UTF-16 as well as UTF-16LE and UTF-16BE for little/big endian byte order.
Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ.
Returns text on success and error on failure.
DescriptionReads a text file.
You have to decide which encoding to use (if not native). We support a few encodings, but we can add more if you need something special. Some characters will be wrong if the encoding is not correct.
See also Files.ReadJPEG, Files.ReadPDF, Files.ReadPNG, Files.ReadFile and RichText.ReadFile.
This function reads only up to 1 GB of text. And even than a 32-bit FileMaker may fail to allocate enough memory to handle the text.
When passing UTF-16 as encoding, we can detect byte order if there is a Byte Order Mark.
Use Container.GetText function to read text content from a file in container.
This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.
Read system.log file:
Read Windows ANSI XML:
Read file on Windows from desktop folder:
Read file with UTF-16 Big Endian:
Parse in VCard with MBS functions:
Read and write file to change some text:
Read file as Base64 encoded:
Change line endings for a text file:
- Version 13.3
- Fixed a problem with Text.ReadTextFile reporting an error for zero byte files.
- CURL/Email/IMAP Email
- Drag and Drop/for Mac/DragTest Email
- Utility functions/Split DDR
- Win Only/Snippets for Windows
- XML/XML Import
- How to use Trace
- MBS FileMaker Plugin, version 13.3pr1
- CSV in FileMaker with MBS FileMaker Plugin
- Import CSV with Matrix functions
- Split XML for DDR into files for GIT
- FileMaker 18 File Script Steps vs. BinaryFile functions
- Parsing VCard file
- Comparing Base Elements Plugin to MBS FileMaker Plugin
- MonkeyBread Software Releases the MBS Filemaker plug-in in version 2.4
- MBS Filemaker Plugin 2.4 release notes
This function is free to use.
Created 18th August 2014, last changed 2nd October 2023