c++ struct
typedef struct _GLYDEPOSITCOUNTER {
unsigned int EventNumber;
struct tm Time;
unsigned int dwSquentialNo;
unsigned int dwUserID;
GLYCOUNTERS DepositData;
} GLYDEPOSITCOUNTER, *LPGLYDEPOSITCOUNTER;
struct tm Time;
Each data range is as described below.
tm_year: 2000 to 2099, tm_mon: 1 to 12, tm_mday: 1 to 31,
tm_hour: 0 to 23, tm_min: 00 to 59, tm_sec: 00 to 59
头文件里没有介绍这个struct tm Time,
文档里只是说了它的取值范围。
我现在的c#转换是:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
public struct Time
{
public uint tm_year;
public uint tm_mon;
public uint tm_mday;
public uint tm_hour;
public uint tm_min;
public uint tm_sec;
}
转换出来的结果和上面介绍的取值不一样,我想肯定转换错了,请高手们帮忙,多谢。
不知道他的结构估计没戏
dynamic代替
请指点
@jerry liu: 类型指定为dynamic,交个.net自己负责
问题已经解决了,从头文件上看到了#include "time.h"
又查了下次文件,结构体的定义如下:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
public struct Time
{
public int tm_sec;
public int tm_min;
public int tm_hour;
public int tm_mday;
public int tm_mon;
public int tm_year;
public int tm_wday;
public int tm_yday;
public int tm_isdst;
}