TextFileSave
From kwiki
| | This article is written by Konrad, thus using rather nonstandard English:) |
TextFileSave (DNM Script function)
Contents |
[edit]
full declaration
bool TextFileSave (string sPath,string sContents,[sTypeFlags="ansi"])
[edit]
return value
[edit]
description
Saves a text file specified by sPath. By default this will create plain ASCII file, unless you specify the sTypeFlags to something different.
Advanced: sTypeFlags may be one of the following:
"ansi": the default value. File will be saved as plain ASCII file.
"utf-16 bom": file will be saved as UNICODE with BOM (UNICODE files in Windows usually should contain it)
"utf-16": file will be saved as UNICODE without BOM (not recommended, UNICODE files in Windows usually should contain BOM)
[edit]
Examples
//Text files sample, using TextFile... functions
//let's save a file, if it doesn't exist - it will be created.
TextFileSave("c:\\test file.txt","Hello world!");
//Load it:
var $s=TextFileLoad("c:\\test file.txt");
//and show the contents:
MessageBox($s);
//Add some text:
TextFileAppend("c:\\test file.txt"," Added text...");
//again, load it:
$s=TextFileLoad("c:\\test file.txt");
//and again, show the contents:
MessageBox($s);
[edit]
See also
keywords: text file save create change modify files
