
81
7:Filename is error
8:Other error
tell
Purpose
:
Get file pointer position of a DAT file.
Syntax
:
long tell(int fd);
Example call
:
current_position = tell(fd);
Includes
:
#include “LIB_CL.h ”
Description
:
The tell function returns the current file pointer position of the
DAT file whose file handle is specified in the argument fd. The
file pointer position is expressed in number of bytes from the
beginning of file. For instance, if the file pointer points to the
beginning of file, the file pointer position will be 0.
Returns
:
The long integer value returned by tell is the current file pointer
position in file. In case of error, tell returns a long value of -1 and
an error code is set to the global variable fErrorCode to indicate
the error condition encountered. Possible error codes and their
interpretation are listed below.
fErrorCode
:
2:File handle is NULL.
7:fd is not a file handle of a previously opened file.
write
Purpose
:
Write a specified number of bytes to a DAT file.
Syntax
:
int write(int fd, char *buffer, unsigned count);
Example call
:
write(fd, data_buffer,100);
Includes
:
#include “LIB_CL.h ”
Description
:
The write function writes the number of bytes specified in the
argument count from the character array buffer to a DAT file
whose file handle is fd. Writing of data starts at the current
position of the file pointer, which is incremented accordingly
when the operation is completed.
If the end-of- file condition is encountered during the operation,
the file will be extended automatically to complete the operation.
Returns
:
The write function returns the number of bytes actually written to
the file. In case of error, write returns an integer value of -1 and
an error code is set to the global variable fErrorCode to indicate
the error condition encountered. Possible error codes and their
interpretation are listed below.
fErrorCode
:
2:File handle is NULL.
7:fd is not a file handle of a previously opened file.