procedure addField (fieldname : String; fieldType : char; length : Integer);
Function addField() adds a field to a new table.
The name can contain alpha-numeric symbols and underscore, should start with letter.
The maximum length for name is 10 characters for all types and 31 for dBase Level 7.
The type is a single letter.
You can set a length for Character, Numeric and Float fields. For other types it is ignored.
You can set a decimal length for Numeric, Float and double fields. For other types it is ignored.
The total length of all fields cannot be more 65535 bytes.
Usually length of Numeric and Float fields cannot be more 20 symbols.
The most of programs support maximum length 255 symbols for Character fields, but it is acceptable to provide bigger value.
procedure addFieldX(fieldname : String; fieldType : char; length : Integer; dec : Integer);
// if dbf.prepareNewTableX(1, 512, nil) then
if dbf.prepareNewTable(0) then
begin
dbf.addField('ID', 'N', 10);
dbf.addField('NAME', 'C', 20);
dbf.addField('BIRTH', 'D', 8);
dbf.addFieldX('WEIGHT', 'N', 10, 2);
// if dbf.createAndOpenTable('testfile.dbf') then
if dbf.createTable('testfile.dbf') then
writeln('OK')
else
writeln('Error');
end;