Core Function FileAppendLines

From Sputnik Wiki
Jump to: navigation, search
FileAppendLines( <file>, <array>, <lineBreak>, <useAscii> )

Contents

Description

Append an array of lines to the end of previously opened file.

Parameters

file

A variable containing the File handle.

array

The array to write to the file.

Each element in the array will be considered a new line for the file.

lineBreak

Optional; The line break to use.

Default: "\n"

useAscii

Optional: Flag to decide if ASCII encoding should be used

True = Save using ASCII encoding

False = Save using UNICODE encoding

Default: false (All strings in Sputnik are Unicode to save them to file you must specifically request ASCII encoding)

Return Value

Success: Returns true

Failure: Returns false if error occurs.

Remarks

N/A

Example

$File = FileOpen("a.txt", "a");
If(isVarObj($File, "file"))
{
	FileAppendLines( $File, array("One", "Two", "Three", "Four") );
	FileClose( $File );
}

Lets use "<br>" for the line breaks

$File = FileOpen("a.txt", "a");
If(isVarObj($File, "file"))
{
	FileAppendLines( $File, array("One", "Two", "Three", "Four"), "<br>" );
	FileClose( $File );
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox