SimpleFile v1.0 

 The Simple Development Library file handling 

Project: the Simple Development Library.

Table of contents

1. Package description
   1.1 Overview
   1.2 Usage
   1.3 Examples
   1.4 History
   1.5 Copyright
2. Package public API
   2.1 Types
   2.2 Options
   2.3 Namespaces
   2.4 Commands
      2.4.1 ::Simple::File::dump fileName fileContents
      2.4.2 ::Simple::File::swallow fileName
   2.5 Errors
      2.5.1 ::Simple::File::NON-READABLE-FILE
      2.5.2 ::Simple::File::CANT-OPEN-FILE
      2.5.3 ::Simple::File::CANT-READ-FILE
      2.5.4 ::Simple::File::CANT-WRITE-FILE
      2.5.5 ::Simple::File::CANT-CLOSE-FILE
3. Package further information
4. Package command details
   4.1 ::Simple::File::dump fileName fileContents
      4.1.1 Command description
         4.1.1.1 Overview
      4.1.2 Command public API
   4.2 ::Simple::File::swallow fileName
      4.2.1 Command description
         4.2.1.1 Overview
      4.2.2 Command public API

1. Package description

Synopsis: the Simple Development Library file handling.

Keywords: file.

1.1 Overview

This package provides procedures for reading and writing files.

1.2 Usage

Use ::Simple::File::swallow to read data from a file and ::Simple::File::dump to write data into a file.

1.3 Examples

1.4 History

Date Reason
17-feb-2003 First public release, version 0.5
22-jun-2005 The Simple Development Library version 1.0

1.5 Copyright

Copyright (C) 1999-2005, Juan C. Gil (jgil@gmv.es).

2. Package public API

Paradigm: procedural.

Requisites: SimpleDeclare 1.0.

2.1 Types

None.

2.2 Options

None.

2.3 Namespaces

  1. ::Simple::File

2.4 Commands

2.4.1 ::Simple::File::dump fileName fileContents

Synopsis: writes a file.

Details: see section 4.1.

2.4.2 ::Simple::File::swallow fileName

Synopsis: reads a file.

Details: see section 4.2.

2.5 Errors

2.5.1 ::Simple::File::NON-READABLE-FILE

Message: file "file" is not readable.

Explanation: the file file is not readable for this user.

Corrective action: change the file permissions.

2.5.2 ::Simple::File::CANT-OPEN-FILE

Message: could not open file "file" for reading or wirintg.

Explanation: the file file could not be opened for reading or wirintg by this user.

Corrective action: change the file and/or directory permissions.

2.5.3 ::Simple::File::CANT-READ-FILE

Message: could not read file "file".

Explanation: there was an error reading the file file.

Corrective action: check the file.

2.5.4 ::Simple::File::CANT-WRITE-FILE

Message: could not write file "file".

Explanation: there was an error writing the file file.

Corrective action: check the file and directory.

2.5.5 ::Simple::File::CANT-CLOSE-FILE

Message: could not close file "file".

Explanation: there was an error clsoing the file file.

Corrective action: ensure there is enough free space on the device.

3. Package further information

None.

4. Package command details

4.1 ::Simple::File::dump fileName fileContents

4.1.1 Command description

Synopsis: writes a file.

Access mode: public.

4.1.1.1 Overview

This procedure writes data into a file. If the file exists it is truncated. The file must be writable.

4.1.2 Command public API

Arguments:

Argument Type Default value/ choices Description
fileName string (n/a) File name
fileContents string (n/a) Data to be written into the file

Returns: the empty string.

4.2 ::Simple::File::swallow fileName

4.2.1 Command description

Synopsis: reads a file.

Access mode: public.

4.2.1.1 Overview

This procedure reads a file and returns its contents. The file must exist and must be readable.

4.2.2 Command public API

Arguments:

Argument Type Default value/ choices Description
fileName string (n/a) File name

Returns: the file contents.