Script functions reference > Script functions in alphabetical order > F > FileWriteLn

FileWriteLn
Syntax
FileWriteLn(filename, str_data);
filename
str_data
Description
Writes data to the specified file, and adds a new line character at the end. You must open the file with FileOpen before calling FileWriteLn, and use the FileClose function to close the file.
Returns
A number indicating whether data was successfully written to the file.
0
>0
Failure. This value can be sent to IoErrText which will return an error text for the failure.
Example
//Write the contents of $utbuf to myfile.txt, 
//add a new line, and store the returned value in $err
 
$err = filewriteln("myfile.txt",$utbuf);
 
//If the action was unsuccessful, pass the error value
//to ioerrtext and store the error text returned by
//ioerrtext in $errtext.
//Send the error text to the log file
 
if(num($err)!=0)
{
$errtext=ioerrtext($err);
log(0,"Errortext "+$errtext);
}
OpenText StreamServe 5.6 Updated: 2013-03-01