请教如题typedef struct TagMosaicDataFileHeader
{
unsigned short iVersion; //格式版本号 1,2,- 2字节
char   Hold1[14];//保留14个字节
char cSiteName[20];//区域名称/雷达站名 20个字节
char strDataType[4];//数据类型  -4 Bytes
unsigned short TotalRadarStationNum;//组网区域内雷达站数
unsigned short int nYear;//观测开始日期--年
unsigned short int nMonth;
unsigned short int nDay;
unsigned short int nHour;
unsigned short int nMinute;
int nStartLongitude;  //数据开始经度,度×1000
int nStartLatitude;//数据开始纬度,度×1000
int nEndLongitude;  //数据终止经度,度×1000
int nEndLatitude;//数据终止纬度,度×1000
unsigned short int nStartHeight;//数据起始高度(m)
unsigned short int nEndHeight;//数据终止高度(m)
unsigned short int  nXNumGrids;//经度方向格点数
unsigned short int  nYNumGrids;//纬度方向格点数
unsigned short int  nZNumGrids;//数据层数
unsigned int nXResolution;//数据经向格距(度)*10000
    unsigned int nYResolution;//数据纬向格距(度)*10000
short nZResolution;//数据高度间隔 (m)(-1:表示间隔不相等)
unsigned int nRadarStationInfoStart;//雷达站信息起始位置(自数据头末尾开始的字节数)
unsigned int nHeightInfoStart;//各层高度数据起始位置(自数据头末尾开始的字节数)
unsigned int nDataInfoStart;//数据起始位置(自数据头0字节开始的字节数)
char   Hold2[8];//保留8个字节
}RadarMosaicDataFileHeader;//拼图头文件
#endif#ifndef RADARSITEINFO
typedef struct TagRADARSITEINFO // 52 Bytes
{
int SiteID; //Site index
char SiteName[20];//Site Name, the number of characters is not more than 20
char SiteType[12];//Site type, whitch indicates data format type <=12 chars
int   SiteLon; //Longtitude of the site(Degree*1000)
int   SiteLat; //Latitude of the site(Degree*1000)
int  SiteHgt; //Height(m) above sea level of the antenner
int     ObsRange;               //Observation range(km)
}RADARSITEINFO;
另最好有c++类型与c#类型对比表。

解决方案 »

  1.   

    这个是我改的,长度是104,原来的那个是112,没郁闷中,怎么让长度一致啊?请教,谢谢大家啊!
    [StructLayout(LayoutKind.Sequential,Pack=4)]
           public unsafe  struct TagMosaicDataFileHeader{
    public UInt16  iVersion; //格式版本号 1,2,- 2字节
        public fixed byte Hold1[14];//保留14个字节
        public fixed byte cSiteName[20];//区域名称/雷达站名 20个字节
        public fixed byte strDataType[4];//数据类型  -4 Bytes
        public UInt16 TotalRadarStationNum;//组网区域内雷达站数
        public UInt16 nYear;//观测开始日期--年
        public UInt16 nMonth;
        public UInt16 nDay;
        public UInt16 nHour;
        public UInt16 nMinute;
        public int nStartLongitude;  //数据开始经度,度×1000
        public int nStartLatitude;//数据开始纬度,度×1000
        public int nEndLongitude;  //数据终止经度,度×1000
        public int nEndLatitude;//数据终止纬度,度×1000
        public UInt16 nStartHeight;//数据起始高度(m)
        public UInt16 nEndHeight;//数据终止高度(m)
        public UInt16 nXNumGrids;//经度方向格点数
        public UInt16 nYNumGrids;//纬度方向格点数
        public UInt16 nZNumGrids;//数据层数
        public UInt16 nXResolution;//数据经向格距(度)*10000
        public UInt16 nYResolution;//数据纬向格距(度)*10000
        public short nZResolution;//数据高度间隔 (m)(-1:表示间隔不相等)
        public UInt32 nRadarStationInfoStart;//雷达站信息起始位置(自数据头末尾开始的字节数)
        public UInt32 nHeightInfoStart;//各层高度数据起始位置(自数据头末尾开始的字节数)
        public UInt32 nDataInfoStart;//数据起始位置(自数据头0字节开始的字节数)
        public fixed byte Hold2[8];//保留8个字节
    };//拼图头文件
      

  2.   

    char chr[255]  O    StringBuilder
    KCA_DIR            I    int
    LPCSTR            I    string
    int                        I    int
    LPSTR              O    StringBuilder
    int*                      O    out int
    DWORD              I    int
    DWORD*          O    out int
    BOOL                I    bool
    Rc_DBMgr          I    IntPtr
    long*                  O    out long 
      

  3.   

    http://topic.csdn.net/u/20100304/11/1d0dfe24-0439-4673-9abb-7dd615156bb1.html
      

  4.   

    [StructLayout(LayoutKind.Sequential,Pack=4)] 
          public unsafe  struct TagMosaicDataFileHeader { 
    public UInt16  iVersion; //格式版本号 1,2,- 2字节 
        public fixed byte Hold1[14];//保留14个字节 
        public fixed byte cSiteName[20];//区域名称/雷达站名 20个字节 
        public fixed byte strDataType[4];//数据类型  -4 Bytes 
        public UInt16 TotalRadarStationNum;//组网区域内雷达站数 
        public UInt16 nYear;//观测开始日期--年 
        public UInt16 nMonth; 
        public UInt16 nDay; 
        public UInt16 nHour; 
        public UInt16 nMinute; 
        public int nStartLongitude;  //数据开始经度,度×1000 
        public int nStartLatitude;//数据开始纬度,度×1000 
        public int nEndLongitude;  //数据终止经度,度×1000 
        public int nEndLatitude;//数据终止纬度,度×1000 
        public UInt16 nStartHeight;//数据起始高度(m) 
        public UInt16 nEndHeight;//数据终止高度(m) 
        public UInt16 nXNumGrids;//经度方向格点数 
        public UInt16 nYNumGrids;//纬度方向格点数 
        public UInt16 nZNumGrids;//数据层数 
        
        public UInt32 nXResolution;//数据经向格距(度)*10000 
        public UInt32 nYResolution;//数据纬向格距(度)*10000 

        public short nZResolution;//数据高度间隔 (m)(-1:表示间隔不相等) 
        public UInt32 nRadarStationInfoStart;//雷达站信息起始位置(自数据头末尾开始的字节数) 
        public UInt32 nHeightInfoStart;//各层高度数据起始位置(自数据头末尾开始的字节数) 
        public UInt32 nDataInfoStart;//数据起始位置(自数据头0字节开始的字节数) 
        public fixed byte Hold2[8];//保留8个字节 
    };//拼图头文件unsigned int是32位的数据,用UInt32 进行代替
      

  5.   

    用上pack=4,改了这两个就可以了。
    public UInt32 nXResolution;//数据经向格距(度)*10000
    public UInt32 nYResolution;//数据纬向格距(度)*10000