Delete_topln, Filelength – Argox PA-20 Programming Guide User Manual
Page 42
![background image](https://www.manualsdir.com/files/772043/content/doc042.png)
PT-20 Programming Guide
40
9:The value of count is negative.
10:No more free file space for file extension.
Purpose: Remove a null terminated character string from the top
(beginning-of-file position) of a DAT file.
Syntax: int delete_topln(int fd);
Example call: delete_topln (fd);
Includes:
#include “SDK.h ”
Description: The delete_topln function removes a line terminated by a null
character file until a null character (\0) or end-of-file is
encountered. The null character is also removed from the file.
Removing of data starts at the top (beginning-of-file position) of
the file, and the file pointer position is adjusted accordingly. The
delete_topln function will resize the file size automatically.
Returns: The delete_topln function returns the number of bytes actually
removed from the file (includes the null character). In case of
error, delete_topln 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 specified by fd does not exist.
8:File not opened
9:The value of count is negative.
10:No more free file space for file extension.
Purpose: Check if file pointer of a DAT file reaches end of file.
Syntax: int eof(int fd);
Example call:
if (eof(fd)) _puts(“end of file reached!\n”);
Includes:
#include “SDK.h ”
Description: The eof function checks if the file pointer of the DAT file whose
file handle is specified in the argument fd, points to end-of-file.
Returns: The eof function returns an integer value of 1 to indicate an
end-of-file and a 0 when not. In case of error, eof returns an
integer value of -1 and an error code is set to the global variable
fErrorCode to indicate the error condition encountered.
fErrorCode: 2:File specified by DBF_fd does not exist.
8:File not opened