Close, Delete_top – Argox PA-20 Programming Guide User Manual
Page 41
PT-20 Programming Guide
39
fErrorCode: 2:File specified by fd does not exist.
8:File not opened
10:No more free file space for file extension.
Purpose: Close a DAT file.
Syntax: int close(int fd);
Example call:
If (close(fd)) _puts(“file closed!\n”);
Includes:
#include “SDK.h ”
Description: Close a previously opened or created DAT file whose file handle
is fd.
Returns: close returns an integer value of 1 to indicate success. In case of
error, close returns an integer value of 0 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 specified by fd does not exist.
8:File not opened
Purpose: Remove a specified number of bytes from top (beginning-of-file
position) of a DAT file.
Syntax: int delete_top(int fd, int count);
Example call: delete_top(fd,100);
Includes:
#include “SDK.h ”
Description: The delete_top function removes the number of bytes specified in
the argument count from a DAT file whose file handle is fd.
Removing of data starts at the beginning-of-file position of the
file. The file pointer position is adjusted accordingly by the
operation. For instance, if initially the file pointer points to the
tenth character, after removing 8 character from the file, the new
file pointer will points to the second character of the file.
The delete_top function will resize the file size automatically.
Returns: The delete_top function returns the number of bytes actually
removed from the file. In case of error, delete_top 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.
fErrorCode: 2:File specified by fd does not exist.
8:File not opened