SHP:
File Header     
Record Header      Record Contents
…    
Record Header     Record Contents
File Header:struct shpFileHeader(100bytes)
Record Header:struct shpRecordHeader(8bytes)
class BIGENDIANDWORD
{
union
{
  DWORD dwData;
  BYTE  bData[4];
};

};
struct ShpFileHeader             //total:100bytes
{
BIGENDIANDWORD bdwFileCode;     //03=4,4bytes
BIGENDIANDWORD bdwUnused[5];    //4
23=20,24bytes
BIGENDIANDWORD bdwFileLength;   //2427=4,28bytes
DWORD dwVersion;                //28
31=4,32bytes
DWORD dwShapeType;              //3235=4,36bytes
double dXmin;                   //36
43=8,44bytes
double dYmin;                   //4451=8,52bytes
double dXmax;                   //52
59=8,60bytes
double dYmax;                   //6067=8,68bytes
double dZmin;                   //68
75=8,76bytes
double dZmax;                   //7683=8,84bytes
double dMmin;                   //84
91=8,92bytes
double dMmax;                   //9299=8,100bytes
};
struct ShpRecordHeader           //total:8bytes
{
BIGENDIANDWORD bdwRecordNo;     //100
103=4,104bytes
BIGENDIANDWORD bdwLength;       //104107=4,108bytes
};
1)bdwRecordNo begins at 1.
2)bdwLength means the length of contents.It equals the record of SHX file`s content length which is from byte4 to byte7.
struct ShapeContentHeader       struct ShapeRoot
{                               {
DWORD ShapeType;                ShapeContentHeader hdr;
};//(1)                         }//(2)
template<class ContentType>
struct Shape:ShapeRoot
{
ContentType shp;
};//(3)
(1)(2)(3)=>
struct Shape
{
DWORD ShapeType;
ContentType shp;
};(4)
Content type is point.
struct Point
{
double x;
double y;
};(5)
(4)(5)=>
Shape<Point>
DWORD ShapeType;        //108
111=4,112bytes
double x;               //112119=8,120bytes
double y;               //120
127=8,128bytes
total:4+8+8=20bytes
Content type is polyline.
union BoundBox
{
double Box[4];
struct
{
  double Xmin,Ymin,Xmax,Ymax;
};
};
struct PolyLine
{
BoundBox Box;
DWORD NumParts;
DWORD NumPoints;
DWORD Parts[];
};
Shape<Polyline>
DWORD ShapeType;      //108111=4,112bytes
double Xmin;
double Ymin;
double Xmax;
double Ymax;         //112
143=32,144bytes
DWORD NumParts;      //144147=4,148bytes
DWORD NumPoints;     //148
151=4,152bytes
The size of polyline =
size of Shape<Polyline>(4+32+4+4=44bytes) +
size of PartsNumParts +
size of PointsNumPoints
Content type is polygon.
struct Polygon
{
BoundBox Box;
DWORD NumParts;
DWORD NumPoints;
DWORD Parts[];
};
Shape<Polygon>
DWORD ShapeType;      //108111=4,112bytes
double Xmin;
double Ymin;
double Xmax;
double Ymax;         //112
143=32,144bytes
DWORD NumParts;      //144147=4,148bytes
DWORD NumPoints;     //148
151=4,152bytes
The size of polygon =
size of Shape<Polygon>(4+32+4+4=44bytes) +
size of PartsNumParts +
size of PointsNumPoints

SHX:
File Header
Record

Record
File Header:struct ShpFileHeader(100bytes)
Record:struct ShxRecord(8bytes)
struct ShxRecord
{
BIGENDIANDWORD bdwOffset;
BIGENDIANDWORD bdwLength;
};
1)Total:108bytes
2)The File Header of SHX file is same as SHPs except bdwLength.<br />3)The bdwLength of SHP file means length of SHP file;SHXs means length of SHX file.

DBF:
dbf file structure
bytes description
00    foxbase+, foxpro, dbaseiii+, dbaseiv, no memo - 0x03
foxbase+, dbaseiii+ with memo - 0x83
    foxpro with memo - 0xf5
    dbaseiv with memo - 0x8b
    dbaseiv with sql table - 0x8e
01-03 last update, format yyyymmdd correction: it is yymmdd
04-07    number of records in file (32-bit number)
08-09    number of bytes in header (16-bit number)
10-11    number of bytes in record (16-bit number)
12-13    reserved, fill with 0x00
14    dbaseiv flag, incomplete transaction
begin transaction sets it to 0x01
    end transaction or rollback reset it to 0x00
15 encryption flag, encrypted 0x01 else 0x00
changing the flag does not encrypt or decrypt the records
16-27 dbaseiv multi-user environment use
28    production index exists - 0x01 else 0x00
29    dbaseiv language driver id
30-31 reserved fill with 0x00
32-n    field descriptor array
n+1    header record terminator - 0x0d
field descriptor array table
bytes description
0-10 field name ascii padded with 0x00
11    field type identifier (see table)
12-15    displacement of field in record
16    field length in bytes
17    field decimal places
18-19    reserved
20    dbaseiv work area id
21-30    reserved
31     field is part of production index - 0x01 else 0x00
field identifier table
ascii description
c character
d date, format yyyymmdd
f floating point
g general - foxpro addition
l logical, t:t,f:f,y:y,n:n,?-not initialized
m memo (stored as 10 digits representing the dbt block number)
n numeric
p picture - foxpro addition
note all dbf field records begin with a deleted flag field.
if record is deleted - 0x2a (asterisk) else 0x20 (space)
end of file is marked with 0x1a

PS:
Big endian&Little endian
low byte high byte
0x12     0x34
Little endian:0x3412
Big endian:0x1234
Byte ordering Byte ordering Meaning
big-endian The most significant byte is on the left end of a word.
little-endian The most significant byte is on the right end of a word.