TextFileLoad
From kwiki
| | This article is written by Konrad, thus using rather nonstandard English:) |
TextFileLoad (DNM Script function)
Contents |
[edit]
full declaration
string TextFileLoad (string sPath)
[edit]
return value
[edit]
description
Loads text file specified by sPath, and returns the result.
If GetLastError returns 0 the function succeeded, otherwise failed.
Advanced: GetLastAdditionalResult will return string, which may be one of the following:
"ansi": if the file was plain ASCII file
"utf-16 bom": if the file was UNICODE file and consisted BOM (in Windows most UNICODE files does)
"utf-16": if the file was UNICODE file
You can use this result in TextFileSave if you want to save the file in the same format as it was oryginally.
[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 load read open contents files
