[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
USAGE
signed int scddcreate(
signed char *filename,
signed int numfields,
SC_FIELD *fields,
signed int style );
PROTOTYPE IN
sc_base.h
DESCRIPTION
scddcreate creates a dBASEIII or dBASEIV compatible data file. A
pointer to an array of SC_FIELD must be passed.
The field description array must be initialized and each element set to
appropriate values. The array determines the organization of the data
record. The data file does not remain open upon exit of this function.
This function will create a new data file even if one had already existed.
Field names and types are converted to all upper case when the file is
created.
Valid field types are:
'C' character (not NULL terminated in record)
'D' date ("yyyymmdd" format)
'F' floating point (valid only for dBASEIV files)
'L' logical (TRUE, FALSE)
'M' memo (memo file record number)
'N' numeric
Both 'F' and 'N' fields are handled as doubles by the library. The library
does not support BCD numbers.
The type of data file created depends upon the value of the style
parameter: SC_DB3 - dBASEIII compatible, or SC_DB4 - dBASEIV
compatible.
RESTRICTIONS
The maximum record length is 4000 bytes.
The maximum number of dBASE III fields is 128, but the maximum number of
dBASEIV fields is 255.
The maximum length of character fields is 254, and they cannot be longer
than 100 if used as a key.
The maximum length of dBASE III numeric fields is 19, but the maximum
length of dBASE IV numeric & float fields is 20.
The length of a date field is forced to 8.
The length of a logical field is forced to 1.
The length of a memo field is forced to 10.
The number of decimal places will be forced to zero for all types except:
1) dBASE III NUMERIC - it must be less than ('len' - 2) and also less
than 16, and
2) dBASE IV NUMERIC and FLOAT - it must be less than ('len' - 2). The
number of decimal places cannot be less than zero.
EXAMPLE
#include <softc.h>
#include <sc_base.h>
void main()
{
SC_FIELD fields[] = {
"name",'c',64,0, /* file name */
"length",'n',10,0, /* file size */
"date",'d',8,0, /* date */
"time",'c',8,0, /* time */
"attribute",'c',3,0 /* file attributes */
};
scdinit(20,0);
scddcreate("TOC.DBF",5,fields,SC_DB3);
scdterm();
}
See Also:
scddcreate
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson