SimpleFile v1.0
The Simple Development Library file handling
Project: the Simple Development Library.
::Simple::File::dump
fileName fileContents::Simple::File::swallow
fileName::Simple::File::NON-READABLE-FILE
::Simple::File::CANT-OPEN-FILE
::Simple::File::CANT-READ-FILE
::Simple::File::CANT-WRITE-FILE
::Simple::File::CANT-CLOSE-FILE
::Simple::File::dump
fileName fileContents::Simple::File::swallow
fileNameSynopsis: the Simple Development Library file handling.
Keywords: file.
This package provides procedures for reading and writing files.
Use ::Simple::File::swallow
to read data from a file and ::Simple::File::dump
to write data into a file.
# Install the package package require SimpleDevLibPackage 1.0 ::Simple::Package::require-and-install SimpleFile # Read a file into a variable set fileContents [::Simple::File::swallow file.dat] # Modify the data append fileContents "\nNew line" # Write the modified data back ::Simple::File::dump file.dat $fileContents
Date | Reason |
17-feb-2003 | First public release, version 0.5 |
22-jun-2005 | The Simple Development Library version 1.0 |
Copyright (C) 1999-2005, Juan C. Gil (jgil@gmv.es).
Paradigm: procedural.
Requisites: SimpleDeclare 1.0
.
None.
None.
::Simple::File
::Simple::File::dump
fileName fileContentsSynopsis: writes a file.
Details: see section 4.1.
::Simple::File::swallow
fileNameSynopsis: reads a file.
Details: see section 4.2.
::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.
::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.
::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.
::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.
::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.
None.
::Simple::File::dump
fileName fileContentsSynopsis: writes a file.
Access mode: public.
This procedure writes data into a file. If the file exists it is truncated. The file must be writable.
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.
::Simple::File::swallow
fileNameSynopsis: reads a file.
Access mode: public.
This procedure reads a file and returns its contents. The file must exist and must be readable.
Arguments:
Argument | Type | Default value/ choices | Description |
fileName | string | (n/a) | File name |
Returns: the file contents.