PT-20 Programming Guide
41
Purpose
:
Get file length information of a DAT file.
Syntax
:
long filelength(int fd);
Example call
:
datasize = filelength(fd);
Includes
:
#include “SDK.h ”
Description
:
The filelength function returns the size in number of bytes of the
DAT file whose file handle is specified in the argument fd.
Returns
:
The long integer value returned by filelength is the size of the
DAT file in number of bytes. In case of error, filelength 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.
fErrorCode
:
2:File specified by fd does not exist.
8:File not opened
filelist
Purpose
:
Get file directory information.
Syntax
:
int filelist(char * file_list);
Example call
:
total_file = filelist(file_list);
Includes
:
#include “SDK.h ”
Description
:
The filelist function copies the file name, file type, and file size
information (separated by a blank character) of all files in
existence into a character array specified in the argument dir.
When char * file_list = NULL
,
it will pass the length that the file
string needs back.
For example, if there are two files in “C:\Data”, the filename are
StoreIn.dat and StoreOut, and their filesize are 100bytes and 150bytes,
the data in the return buffer is “C:\Data\StoreIn.dat dat 100
C:\Data\
StoreOut.dat dat 150”
Returns
:
When “char*file_list” is NULL, it will pass the size of memory
back.
When “char*file_list” is not NULL, it will pass the quantity of file
back.
fErrorCode
:
None
lseek
Purpose
:
Move file pointer of a DAT file to a new position.
Syntax
:
long lseek(int fd, long offset, int origin);
Example call
:
lseek (fd, 512, 0);
Includes
:
#include “SDK.h ”