
Chapter 3 Terminal Specific Function Library
201
create_DBF
Purpose
To create a DBF file and get its file handle for further processing.
Syntax
int create_DBF (char *filename, int member_len);
char *filename; /* name of the file to be created */
int member_len; /* member (record) length of the DBF file */
Example
if (fd = create_DBF ("data1", 64) > 0) puts ("data1 is created!\n");
Description
This routine creates a DBF file (
filename
) with its member length specified
(
member_len
), and gets the file handle of it.
A file handle is a positive integer (greater than zero) used to identify the
file for subsequent file manipulation on the file.
If
filename
exceeds eight characters, it will be truncated to eight
characters.
The argument
member_len
specifies the maximum member length of the
DBF file. Any member subsequently added to this DBF file with length
greater than
member_len
will be truncated to fit in.
User-defined indexes may be created after the DBF file is created.
Return
If successful, it returns the file handle.
On error, it returns -1.
An error code is set to the global variable fErrorCode to indicate the error
condition encountered. Below are possible error codes and their interpretation.
Error Code
Interpretation
1
filename
is a NULL string.
6
Cannot create file. Because it is beyond the maximum
number of files allowed in the system.
9
Invalid value in argument:
member_len
12
File specified by
filename
already exists.
See Also
close_DBF, create_index, open_DBF
create_index
Purpose
To create an IDX file of a DBF file.
Syntax
int create_IDX (int DBF_fd, int key_number, int key_offset, int key_len);
int DBF_fd; /* file handle of the associated DBF file */
int key_number; /* key number of the IDX file to be created */
int key_offset; /* offset in bytes where the key value in a member begins */
int key_len; /* length of key value of the IDX file */
Example
create_index (DBF_fd, 1, 0, 10);
Summary of Contents for Optimus R
Page 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Page 6: ......
Page 8: ...2 C Programming Guide For Optimus S R...
Page 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Page 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Page 24: ...18 C Programming Guide For Optimus S R...
Page 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...