Module "file"
=============

This module provides a simple API for reading and writing files
 
builtin file_read(filename, encoding);
--------------------------------------

This function reads the specified filename and returns the file content.

If the file is not UTF-8 encoded, the encoding must be specified with a
2nd parameter. Valid encodings are the same as for the '#encoding' compiler
pragma (see 'SPL Language Reference' for a list).

A FileEx exception is thrown on I/O errors.
 

builtin file_write(filename, content, encoding);
------------------------------------------------

This function writes the specified content to the specified filename. The
file is created if neccassary and overwritten if it is already there.

If the file should not be UTF-8 encoded, the encoding must be specified with
a 3rd parameter. Valid encodings are the same as for the '#encoding'
compiler pragma (see 'SPL Language Reference' for a list).

A FileEx exception is thrown on I/O errors.
 

builtin file_delete(filename);
------------------------------

This function removes the specified file.
A FileEx exception is thrown on I/O errors.
 

builtin file_list(dirname);
---------------------------

This function returns the list of files in the specified directory.
A FileEx exception is thrown on I/O errors.
 

builtin file_access(filename, mode);
------------------------------------

This function returns true if the file can be accessed in the specified
mode. The mode argument is a string that may contain the characters 'R',
'W', 'X' and 'F'.
 

object FileEx
-------------

An instance of this object is thrown on file I/O errors.
 

var FileEx.type;
~~~~~~~~~~~~~~~~

Specifies the type of operation which failed:
	"write", "read" or "delete"
 

var FileEx.filename;
~~~~~~~~~~~~~~~~~~~~

The filename of which the operation should have been performed.
 

var FileEx.errmsg;
~~~~~~~~~~~~~~~~~~

The error message returned by the operating system
 

var FileEx.description;
~~~~~~~~~~~~~~~~~~~~~~~

A full error description including the information from
type, filename and errmsg.
 
