Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 9.5   10.0   10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2    Statistic    FMM    Blog  

Text.AppendTextFile

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.

Component Version macOS Windows Linux Server FileMaker iOS SDK
Text 2.8 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Text.AppendTextFile"; Text; FilePath { ; encoding } )   More

(old name: String.AppendTextFile)

Parameters

Parameter Description Example Flags
Text The text to save. "Hello World"
FilePath 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. "test.txt"
encoding The text encoding for text parameter.
Default is native.
Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ.
"UTF-8" Optional

Result

Returns "OK" or an error message.

Description

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.
If the file does not exist, it will be created. You can use this function for logging to a text file.
Please use Text.ReplaceNewline to define which line endings the file has.

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.

Examples

Write UTF-8 file with some text:

MBS("Text.AppendTextFile"; $Text; $Path; "utf8" )

Write a test text file:

MBS("Text.AppendTextFile"; "Hello World. Some umlauts: äöü"; "/Users/cs/Desktop/testfile.txt"; "native")

See also

Blog Entries

Created 18th August 2014, last changed 16th September 2016


Text.AddLineNumbers   -   Text.CapitalCase

Feedback: Report problem or ask question.




Links
MBS Xojo blog

Start Chat