TCCFileIO.cc

Summary
TCCFileIO.cc
Functions
f__FIO__get__error__string Returns the actual error message.
f__FIO__get__error__code Returns the actual error code.
f__FIO__realize__error Builds the error message.
f__FIO__opened Checks if the file with the given name is already opened.
f__FIO__opened Checks if there is a file opened with the given file descriptor.
f__FIO__open Opens a file with the given name in the given mode.
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__close Closes a file associated with the given file descriptor.
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__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__flush Transfers (“flushes”) all modified in-core data of the file referred to by the file descriptor to the disk device.
f__FIO__write Writes the given data to the file associated with the given file descriptor.
f__FIO__write__text A wrapper function for f__FIO__write.
f__FIO__write__text__flush A wrapper function for f__FIO__write.
f__FIO__write__data A wrapper function for f__FIO__write.
f__FIO__write__data__flush A wrapper function for f__FIO__write.
f__FIO__read Reads a given number of bytes to a given buffer from a file associated with the given file descriptor.
f__FIO__read__text A wrapper function for f__FIO__read.
f__FIO__read__data A wrapper function for f__FIO__read.
f__FIO__read__text__until It reads textual data until a given pattern is matched.
f__FIO__read__data__until It reads binary data until a given pattern is matched.
f__FIO__set__filedescriptor__previousline It sets the file descriptor to the begin of the previous line.
f__FIO__read__data__TLV It reads binary data until a full ASN.1 TLV structure is read.
f__FIO__chdir It changes the current directory.
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__get__error__string

Returns the actual error message.

Returns

The actual error message as a string.

f__FIO__get__error__code

Returns the actual error code.

Returns

The actual error message as a string.

f__FIO__realize__error

Builds the error message.  (For internal use only.)

Returns

Always -1.

f__FIO__opened

Checks if the file with the given name is already opened.  This function runs in linear time.  (For internal use only.)

Parameters

NAME The name of the file.

Returns

The file descriptor of the file or -1 if the file is not yet opened.

f__FIO__opened

Checks if there is a file opened with the given file descriptor.  This function runs in logarithmic time.  (For internal use only.)

Parameters

FD The descriptor for the file.

Returns

The name of the file or an empty string if the file is not yet opened.

f__FIO__open

Opens a file with the given name in the given mode.  It creates the file if it doesn’t exist.  (For internal use only.)

Parameters

NAME The name of the file.
FLAGS The way to open the file.

Returns

The file descriptor for the file or -1 on error.  The error message is available through the f__FIO__get__error function.

f__FIO__open__rdonly

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

What f__FIO__open returns.

f__FIO__open__append__wronly

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

What f__FIO__open returns.

f__FIO__open__append__rdwr

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

What f__FIO__open returns.

f__FIO__open__trunc__wronly

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

What f__FIO__open returns.

f__FIO__open__trunc__rdwr

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

What f__FIO__open returns.

f__FIO__close

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__open__append__wronly__excl

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

What f__FIO__open returns or -1 if the file cannot be locked.

f__FIO__open__append__rdwr__excl

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

What f__FIO__open returns or -1 if the file cannot be locked.

f__FIO__open__trunc__wronly__excl

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

What f__FIO__open returns or -1 if the file cannot be locked.

f__FIO__open__trunc__rdwr__excl

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

What f__FIO__open returns or -1 if the file cannot be locked.

f__FIO__seek__home

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

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

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

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__flush

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 fsync returns.

f__FIO__write

Writes the given data to the file associated with the given file descriptor.  It works with textual and binary data.  (For internal use only.)

Parameters

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

Returns

The number of bytes written or -1 on error.

f__FIO__write__text

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

What f__FIO__write returns.

f__FIO__write__text__flush

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

What f__FIO__write returns.

f__FIO__write__data

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

What f__FIO__write returns.

f__FIO__write__data__flush

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

What f__FIO__write returns.

f__FIO__read

Reads a given number of bytes to a given buffer from a file associated with the given file descriptor.  (For internal use only.)

Parameters

FD A file descriptor.
DATA The buffer where the data will be stored.
BYTES The number of bytes to read.

Returns

The number of bytes read or -1 if the requested number of bytes couldn’t be read.

f__FIO__read__text

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

What f__FIO__read returns.

f__FIO__read__data

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

What f__FIO__read returns.

f__FIO__read__text__until

It reads textual data until a given pattern is matched.

Parameters

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

Returns

The number of bytes read from the file, not including the delimiter.  In case of error it returns -1.

f__FIO__read__data__until

It reads binary data until a given pattern is matched.

Parameters

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

Returns

The number of bytes read from the file, not including the delimiter.  In case of error it returns -1.

f__FIO__set__filedescriptor__previousline

It sets the file descriptor to the begin of the previous line.

Parameters

FD A file descriptor.

Returns

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

f__FIO__read__data__TLV

It reads binary data until a full ASN.1 TLV structure is read.

Parameters

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

Returns

The number of bytes read from the file.  In case of error it returns -1.

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

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

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

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

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

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