TCCFileIO_Functions

Purpose

This module supports file I/O handling

Module Parameters

-

Module depends on

-

Summary
TCCFileIO_Functions This module supports file I/O handling
Functions
f_FIO_open_rdonly A wrapper function for f_FIO_open.
f_FIO_open_append_wronly A wrapper function for f_FIO_open.
f_FIO_open_append_rdwr A wrapper function for f_FIO_open.
f_FIO_open_trunc_wronly A wrapper function for f_FIO_open.
f_FIO_open_trunc_rdwr A wrapper function for f_FIO_open.
f_FIO_open_append_wronly_excl A wrapper function for f_FIO_open.
f_FIO_open_append_rdwr_excl A wrapper function for f_FIO_open.
f_FIO_open_trunc_wronly_excl A wrapper function for f_FIO_open.
f_FIO_open_trunc_rdwr_excl A wrapper function for f_FIO_open.
f_FIO_close Closes a file associated with the given file descriptor.
f_FIO_seek_home Moves the file pointer to the beginning of the file.
f_FIO_seek_end Moves the file pointer to the end of the file.
f_FIO_seek_forward Moves the file pointer forward with a given number of bytes from the current position.
f_FIO_seek_backward Moves the file pointer backward with a given number of bytes from the current position.
f_FIO_write_data A wrapper function for f_FIO_write.
f_FIO_write_text A wrapper function for f_FIO_write.
f_FIO_write_data_flush A wrapper function for f_FIO_write.
f_FIO_write_text_flush A wrapper function for f_FIO_write.
f_FIO_flush Transfers (“flushes”) all modified in-core data of the file referred to by the file descriptor to the disk device.
f_FIO_read_data A wrapper function for f_FIO_read.
f_FIO_read_text A wrapper function for f_FIO_read.
f_FIO_read_text_until A wrapper function for f_FIO_read_until.
f_FIO_read_data_until A wrapper function for f_FIO_read_until.
f_FIO_read_data_TLV A wrapper function for f_FIO_read.
f_FIO_get_error_string Returns the actual error message.
f_FIO_get_error_code Returns the actual error code.
f_FIO_set_filedescriptor_previousline If there was no problem, then the return value will be 1.
f_FIO_chdir A wrapper function for f_FIO_chdir.
f_FIO_mkdir Create a new directory
f_FIO_rmdir Removes a directory
f_FIO_fileOrDirExists Checks the existence of files and directories.
f_FIO_stat Query the permissions of the file or directory.
f_FIO_chmod Change the permissions of the file or directory.

Functions

f_FIO_open_rdonly

external function f_FIO_open_rdonly ( in  charstring  pl_name ) return integer

A wrapper function for f_FIO_open.  It opens the file with the given name for reading only.

Parameters

NAME The name of the file.

Returns

A valid file descriptor or -1 on error.

f_FIO_open_append_wronly

external function f_FIO_open_append_wronly (
    in  charstring  pl_name
) return integer

A wrapper function for f_FIO_open.  It opens the file with the given name for writing only.  If the file already exists it is opened in appending mode.

Parameters

NAME The name of the file.

Returns

A valid file descriptor or -1 on error.

f_FIO_open_append_rdwr

external function f_FIO_open_append_rdwr ( in  charstring  pl_name ) return integer

A wrapper function for f_FIO_open.  It opens the file with the given name for reading and writing.  If the file already exists it is opened in appending mode.

Parameters

NAME The name of the file.

Returns

A valid file descriptor or -1 on error.

f_FIO_open_trunc_wronly

external function f_FIO_open_trunc_wronly (
    in  charstring  pl_name
) return integer

A wrapper function for f_FIO_open.  It opens the file with the given name for writing only.  If the file was not empty it is truncated.

Parameters

NAME The name of the file.

Returns

A valid file descriptor or -1 on error.

f_FIO_open_trunc_rdwr

external function f_FIO_open_trunc_rdwr ( in  charstring  pl_name ) return integer

A wrapper function for f_FIO_open.  It opens the file with the given name for reading and writing.  If the file was not empty it is truncated.

Parameters

NAME The name of the file.

Returns

A valid file descriptor or -1 on error.

f_FIO_open_append_wronly_excl

external function f_FIO_open_append_wronly_excl (
    in  charstring  pl_name
) return integer

A wrapper function for f_FIO_open.  It opens the file with the given name for writing only in exclusive mode.  If the file already exists it is opened in appending mode.

Parameters

NAME The name of the file.

Returns

A valid file descriptor or -1 on error.

f_FIO_open_append_rdwr_excl

external function f_FIO_open_append_rdwr_excl (
    in  charstring  pl_name
) return integer

A wrapper function for f_FIO_open.  It opens the file with the given name for reading and writing in exclusive mode.  If the file already exists it is opened in appending mode.

Parameters

NAME The name of the file.

Returns

A valid file descriptor or -1 on error.

f_FIO_open_trunc_wronly_excl

external function f_FIO_open_trunc_wronly_excl (
    in  charstring  pl_name
) return integer

A wrapper function for f_FIO_open.  It opens the file with the given name for writing only in exclusive mode.  If the file was not empty it is truncated.

Parameters

NAME The name of the file.

Returns

A valid file descriptor or -1 on error.

f_FIO_open_trunc_rdwr_excl

external function f_FIO_open_trunc_rdwr_excl (
    in  charstring  pl_name
) return integer

A wrapper function for f_FIO_open.  It opens the file with the given name for reading and writing in exclusive mode.  If the file was not empty it is truncated.

Parameters

NAME The name of the file.

Returns

A valid file descriptor or -1 on error.

f_FIO_close

external function f_FIO_close ( in  integer  pl_fd ) return integer

Closes a file associated with the given file descriptor.

Parameters

FD The file descriptor to close.

Returns

What the POSIX function close returns.

f_FIO_seek_home

external function f_FIO_seek_home ( in  integer  pl_fd ) return integer

Moves the file pointer to the beginning of the file.

Parameters

FD A file descriptor.

Returns

What the POSIX function lseek returns.

f_FIO_seek_end

external function f_FIO_seek_end ( in  integer  pl_fd ) return integer

Moves the file pointer to the end of the file.

Parameters

FD A file descriptor.

Returns

What the POSIX function lseek returns.

f_FIO_seek_forward

external function f_FIO_seek_forward ( in  integer  pl_fd,
in  integer  pl_bytes ) return integer

Moves the file pointer forward with a given number of bytes from the current position.

Parameters

FD A file descriptor.
BYTES The number of bytes.

Returns

What the POSIX function lseek returns.

f_FIO_seek_backward

external function f_FIO_seek_backward ( in  integer  pl_fd,
in  integer  pl_bytes ) return integer

Moves the file pointer backward with a given number of bytes from the current position.

Parameters

FD A file descriptor.
BYTES The number of bytes.

Returns

What the POSIX function lseek returns.

f_FIO_write_data

external function f_FIO_write_data ( in  integer  pl_fd,
in  octetstring  pl_data ) return integer

A wrapper function for f_FIO_write.  It writes binary data.

Parameters

FD A file descriptor.
DATA The data to write to the file.

Returns

Number of bytes written or -1 on error.

f_FIO_write_text

external function f_FIO_write_text ( in  integer  pl_fd,
in  charstring  pl_text ) return integer

A wrapper function for f_FIO_write.  It writes textual data.

Parameters

FD A file descriptor.
TEXT The text to write to the file.

Returns

Number of bytes written or -1 on error.

f_FIO_write_data_flush

external function f_FIO_write_data_flush (
    in  integer  pl_fd,
    in  octetstring  pl_data
) return integer

A wrapper function for f_FIO_write.  It writes binary data and calls f_FIO_flush.

Parameters

FD A file descriptor.
DATA The data to write to the file.

Returns

Number of bytes written or -1 on error.

f_FIO_write_text_flush

external function f_FIO_write_text_flush ( in  integer  pl_fd,
in  charstring  pl_text ) return integer

A wrapper function for f_FIO_write.  It writes textual data and calls f_FIO_flush.

Parameters

FD A file descriptor.
TEXT The text to write to the file.

Returns

Number of bytes written or -1 on error.

f_FIO_flush

external function f_FIO_flush ( in  integer  pl_fd ) return integer

Transfers (“flushes”) all modified in-core data of the file referred to by the file descriptor to the disk device.

Parameters

FD A file descriptor.

Returns

What the POSIX function fsync returns.

f_FIO_read_data

external function f_FIO_read_data ( in  integer  pl_fd,
inout  octetstring  pl_data,
in  integer  pl_bytes ) return integer

A wrapper function for f_FIO_read.  It reads binary data.

Parameters

FD A file descriptor.
DATA The buffer for storing the data.
BYTES The number of bytes to read.

Returns

Number of bytes read or -1 on error.

f_FIO_read_text

external function f_FIO_read_text ( in  integer  pl_fd,
inout  charstring  pl_text,
in  integer  pl_bytes ) return integer

A wrapper function for f_FIO_read.  It reads textual data.

Parameters

FD A file descriptor.
TEXT The buffer for storing the text.
BYTES The number of bytes to read.

Returns

Number of bytes read or -1 on error.

f_FIO_read_text_until

external function f_FIO_read_text_until (
    in  integer  pl_fd,
    inout  charstring  pl_text,
    in  charstring  pl_separator
) return integer

A wrapper function for f_FIO_read_until.  It reads textual data.

Parameters

FD A file descriptor.
TEXT The buffer for storing the text.
SEPARATOR The separator pattern.

Returns

Number of bytes read or -1 on error.

f_FIO_read_data_until

external function f_FIO_read_data_until (
    in  integer  pl_fd,
    inout  octetstring  pl_data,
    in  octetstring  pl_separator
) return integer

A wrapper function for f_FIO_read_until.  It reads binary data.

Parameters

FD A file descriptor.
TEXT The buffer for storing the data.
SEPARATOR The separator pattern.

Returns

Number of bytes read or -1 on error.

f_FIO_read_data_TLV

external function f_FIO_read_data_TLV (
    in  integer  pl_fd,
    inout  octetstring  pl_data
) return integer

A wrapper function for f_FIO_read.  It reads a full ASN.1 TLV structure in binary data format.

Parameters

FD A file descriptor.
TEXT The buffer for storing the data.
SEPARATOR The separator pattern.

Returns

Number of bytes read or -1 on error.

f_FIO_get_error_string

external function f_FIO_get_error_string () return charstring

Returns the actual error message.

Returns

The actual error message as a string.

f_FIO_get_error_code

external function f_FIO_get_error_code () return integer

Returns the actual error code.

Returns

The actual error code.

f_FIO_set_filedescriptor_previousline

external function f_FIO_set_filedescriptor_previousline (
    in  integer  pl_fd
) return integer

Returns

If there was no problem, then the return value will be 1.

f_FIO_chdir

external function f_FIO_chdir ( in  charstring  pl_name ) return boolean

A wrapper function for f_FIO_chdir.  It changes the current directory.

Parameters

NAME The name of the new directory.

Returns

Boolean value for successful or unsuccessful directory change

f_FIO_mkdir

external function f_FIO_mkdir ( in  charstring  p_dir_name ) return boolean

Purpose

Create a new directory

Parameters

p_dir_name in charstring - name of the directory to create

Return Value

boolean indicate the successful or unsuccessful directory creation

Errors

In the case of unsuccessful operation the cause of the error can be queried by the f_FIO_get_error_code, f_FIO_get_error_string functions

Detailed description

The path to the directory must exist, so the existence of the path should be checked, and the missing directories should be created recursively.

f_FIO_rmdir

external function f_FIO_rmdir ( in  charstring  p_dir_name ) return boolean

Purpose

Removes a directory

Parameters

p_dir_name in charstring - name of the directory to remove

Return Value

boolean indicate the successful or unsuccessful directory creation

Errors

In the case of unsuccessful operation the cause of the error can be queried by the f_FIO_get_error_code, f_FIO_get_error_string functions

Detailed description

The directories must be empty, so the child directories should be cleaned and deleted recursively.

f_FIO_fileOrDirExists

external function f_FIO_fileOrDirExists ( in  charstring  p_name ) return boolean

Purpose

Checks the existence of files and directories.

Parameters

p_name in charstring - name of the file or directory to check

Return Value

boolean indicate the exictense of the file or diectory

Errors

-

Detailed description

-

f_FIO_stat

external function f_FIO_stat ( in  charstring  p_name,
out  FIO_permissions  p_permissions ) return boolean

Purpose

Query the permissions of the file or directory.

Parameters

p_name in charstring - name of the file or directory to check
p_permissions out FIO_permissions - the permissions of the object

Return Value

boolean indicate sucessfull execution

Errors

-

Detailed description

-

f_FIO_chmod

external function f_FIO_chmod ( in  charstring  p_name,
in  FIO_permissions  p_permissions ) return boolean

Purpose

Change the permissions of the file or directory.

Parameters

p_name in charstring - name of the file or directory to check
p_permissions in FIO_permissions - the permissions of the object

Return Value

boolean indicate sucessfull execution

Errors

-

Detailed description

Change the permissions of the file or directory according to the p_permissions.  If the value of the field is:

  • true: set the permission
  • false: clear the permission
  • omit: doesn’t change the permission
external function f_FIO_open_rdonly ( in  charstring  pl_name ) return integer
A wrapper function for f_FIO_open.
external function f_FIO_open_append_wronly (
    in  charstring  pl_name
) return integer
A wrapper function for f_FIO_open.
external function f_FIO_open_append_rdwr ( in  charstring  pl_name ) return integer
A wrapper function for f_FIO_open.
external function f_FIO_open_trunc_wronly (
    in  charstring  pl_name
) return integer
A wrapper function for f_FIO_open.
external function f_FIO_open_trunc_rdwr ( in  charstring  pl_name ) return integer
A wrapper function for f_FIO_open.
external function f_FIO_open_append_wronly_excl (
    in  charstring  pl_name
) return integer
A wrapper function for f_FIO_open.
external function f_FIO_open_append_rdwr_excl (
    in  charstring  pl_name
) return integer
A wrapper function for f_FIO_open.
external function f_FIO_open_trunc_wronly_excl (
    in  charstring  pl_name
) return integer
A wrapper function for f_FIO_open.
external function f_FIO_open_trunc_rdwr_excl (
    in  charstring  pl_name
) return integer
A wrapper function for f_FIO_open.
external function f_FIO_close ( in  integer  pl_fd ) return integer
Closes a file associated with the given file descriptor.
external function f_FIO_seek_home ( in  integer  pl_fd ) return integer
Moves the file pointer to the beginning of the file.
external function f_FIO_seek_end ( in  integer  pl_fd ) return integer
Moves the file pointer to the end of the file.
external function f_FIO_seek_forward ( in  integer  pl_fd,
in  integer  pl_bytes ) return integer
Moves the file pointer forward with a given number of bytes from the current position.
external function f_FIO_seek_backward ( in  integer  pl_fd,
in  integer  pl_bytes ) return integer
Moves the file pointer backward with a given number of bytes from the current position.
external function f_FIO_write_data ( in  integer  pl_fd,
in  octetstring  pl_data ) return integer
A wrapper function for f_FIO_write.
external function f_FIO_write_text ( in  integer  pl_fd,
in  charstring  pl_text ) return integer
A wrapper function for f_FIO_write.
external function f_FIO_write_data_flush (
    in  integer  pl_fd,
    in  octetstring  pl_data
) return integer
A wrapper function for f_FIO_write.
external function f_FIO_write_text_flush ( in  integer  pl_fd,
in  charstring  pl_text ) return integer
A wrapper function for f_FIO_write.
external function f_FIO_flush ( in  integer  pl_fd ) return integer
Transfers (“flushes”) all modified in-core data of the file referred to by the file descriptor to the disk device.
external function f_FIO_read_data ( in  integer  pl_fd,
inout  octetstring  pl_data,
in  integer  pl_bytes ) return integer
A wrapper function for f_FIO_read.
external function f_FIO_read_text ( in  integer  pl_fd,
inout  charstring  pl_text,
in  integer  pl_bytes ) return integer
A wrapper function for f_FIO_read.
external function f_FIO_read_text_until (
    in  integer  pl_fd,
    inout  charstring  pl_text,
    in  charstring  pl_separator
) return integer
A wrapper function for f_FIO_read_until.
external function f_FIO_read_data_until (
    in  integer  pl_fd,
    inout  octetstring  pl_data,
    in  octetstring  pl_separator
) return integer
A wrapper function for f_FIO_read_until.
external function f_FIO_read_data_TLV (
    in  integer  pl_fd,
    inout  octetstring  pl_data
) return integer
A wrapper function for f_FIO_read.
external function f_FIO_get_error_string () return charstring
Returns the actual error message.
external function f_FIO_get_error_code () return integer
Returns the actual error code.
external function f_FIO_set_filedescriptor_previousline (
    in  integer  pl_fd
) return integer
If there was no problem, then the return value will be 1.
external function f_FIO_chdir ( in  charstring  pl_name ) return boolean
A wrapper function for f_FIO_chdir.
external function f_FIO_mkdir ( in  charstring  p_dir_name ) return boolean
Create a new directory
external function f_FIO_rmdir ( in  charstring  p_dir_name ) return boolean
Removes a directory
external function f_FIO_fileOrDirExists ( in  charstring  p_name ) return boolean
Checks the existence of files and directories.
external function f_FIO_stat ( in  charstring  p_name,
out  FIO_permissions  p_permissions ) return boolean
Query the permissions of the file or directory.
external function f_FIO_chmod ( in  charstring  p_name,
in  FIO_permissions  p_permissions ) return boolean
Change the permissions of the file or directory.