home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / nieuûytki / dbf2asc / english / dbf.doc next >
Text File  |  1996-05-13  |  4KB  |  85 lines

  1. dBASE III interface routines for C.
  2. Author Mark Sadler  June 19, 1987
  3.  
  4. ...
  5.  
  6. dBASE III stores all records in ascii format.  Character fields are stored
  7. padded with spaces ('\x20' rather than nulls).  Numbers are right justified
  8. within their field and again padded with spaces.  Logical fields are single
  9. bytes containing T,t,y,F,f,n.
  10.  
  11. ...
  12.  
  13. The structure of dBASE III files is as follows:
  14.  
  15. dBASE III DATABASE FILE HEADER:
  16. +---------+-------------------+---------------------------------+
  17. |  BYTE   |     CONTENTS      |          MEANING                |
  18. +---------+-------------------+---------------------------------+
  19. |  0      |  1 byte           | dBASE III version number        |
  20. |         |                   |  (03H without a .DBT file)      |
  21. |         |                   |  (83H with a .DBT file)         |
  22. +---------+-------------------+---------------------------------+
  23. |  1-3    |  3 bytes          | date of last update             |
  24. |         |                   |  (YY MM DD) in binary format    |
  25. +---------+-------------------+---------------------------------+
  26. |  4-7    |  32 bit number    | number of records in data file  |
  27. +---------+-------------------+---------------------------------+
  28. |  8-9    |  16 bit number    | length of header structure      |
  29. +---------+-------------------+---------------------------------+
  30. |  10-11  |  16 bit number    | length of the record            |
  31. +---------+-------------------+---------------------------------+
  32. |  12-31  |  20 bytes         | reserved bytes (version 1.00)   |
  33. +---------+-------------------+---------------------------------+
  34. |  32-n   |  32 bytes each    | field descriptor array          |
  35. |         |                   |  (see below)                    |---+
  36. +---------+-------------------+---------------------------------+   |
  37. |  n+1    |  1 byte           | 0DH as the field terminator     |   |
  38. +---------+-------------------+---------------------------------+   |
  39. |                                                                   |
  40. |                                                                   |
  41. A FIELD DESCRIPTOR:      <------------------------------------------+
  42. +---------+-------------------+---------------------------------+
  43. |  BYTE   |     CONTENTS      |          MEANING                |
  44. +---------+-------------------+---------------------------------+
  45. |  0-10   |  11 bytes         | field name in ASCII zero-filled |
  46. +---------+-------------------+---------------------------------+
  47. |  11     |  1 byte           | field type in ASCII             |
  48. |         |                   |  (C N L D or M)                 |
  49. +---------+-------------------+---------------------------------+
  50. |  12-15  |  32 bit number    | field data address              |
  51. |         |                   |  (address is set in memory)     |
  52. +---------+-------------------+---------------------------------+
  53. |  16     |  1 byte           | field length in binary          |
  54. +---------+-------------------+---------------------------------+
  55. |  17     |  1 byte           | field decimal count in binary   |
  56. +---------+-------------------+---------------------------------|
  57. |  18-31  |  14 bytes         | reserved bytes (version 1.00)   |
  58. +---------+-------------------+---------------------------------+
  59. The data records are layed out as follows:
  60. 1. Data records are preceeded by one byte that is a
  61.    space (20H) if the record is not deleted and an
  62.    asterisk (2AH) if it is deleted.
  63. 2. Data fields are packed into records with no field
  64.    separators or record terminators.
  65. 3. Data types are stored in ASCII format as follows:
  66. DATA TYPE      DATA RECORD STORAGE
  67. ---------      --------------------------------------------
  68. Character      (ASCII characters)
  69. Numeric        - . 0 1 2 3 4 5 6 7 8 9
  70. Logical        ? Y y N n T t F f  (? when not initialized)
  71. Memo           (10 digits representing a .DBT block number)
  72. Date           (8 digits in YYYYMMDD format, such as
  73.                 19840704 for July 4, 1984)
  74.  
  75. This information came directly from the Ashton-Tate Forum. It can also be
  76. found in the Advanced Programmer's Guide available from Ashton-Tate.
  77.  
  78. One slight difference occurs between files created by dBASE III and those
  79. created by dBASE III Plus.  In the earlier files, there is an ASCII NUL
  80. character between the $0D end of header indicator and the start of the
  81. data. This NUL is no longer present in Plus, making a Plus header one byte
  82. smaller than an identically structured III file.
  83.  
  84. ...
  85.