TextFileSave

From Wiki

Jump to: navigation, search
This article is written by Konrad, thus using rather nonstandard English:)

TextFileSave (DNM Script function)

Contents

full declaration

bool TextFileSave (string sPath,string sContents,[sTypeFlags="ansi"])

return value

bool

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)

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);

See also


keywords: text file save create change modify files
Personal tools
konradp.com