#pragma pack(1)
typedef struct tagNetCell
{
unsigned char id;
std::vector<unsigned char> mac;
unsigned int dwIpAddr;
}NetCell;
#pragma pack()int nSize = sizeof(NetCell);
结果,nSize 等于15.
..........................................
问题是,我想在结构中定义std::vector<unsigned char> mac时,指定mac的尺寸为6,
即 写成 std::vector<unsigned char> mac(6);
但是,编译的时候发生错误,提示说“syntax error : 'constant'”,我怎么声明mac,才能让sizeof(NetCell) 等于11阿
typedef struct tagNetCell
{
unsigned char id;
std::vector<unsigned char> mac;
unsigned int dwIpAddr;
}NetCell;
#pragma pack()int nSize = sizeof(NetCell);
结果,nSize 等于15.
..........................................
问题是,我想在结构中定义std::vector<unsigned char> mac时,指定mac的尺寸为6,
即 写成 std::vector<unsigned char> mac(6);
但是,编译的时候发生错误,提示说“syntax error : 'constant'”,我怎么声明mac,才能让sizeof(NetCell) 等于11阿
解决方案 »
- 更改对话框的圆角形状!//为什么没出来?只出来俩个圆角呢
- 在窗体中间做字幕滚动特效的问题
- GetOverlappedResult返回读到的数据为0
- vc访问access,sql语句可以执行,程序无法获得数据,有代码,请指教
- 一个有趣的问题,关于主进程与分进程
- ===关于SPI的基础服务提供者问题===
- 多线程同步--在一个类中构造函数中用CreateEvent()创建一个信号,CreateEvent(0, TRUE, TRUE, port)...
- 会者不难!
- 各位大哥请帮下忙,在下不知道如何把VC程序打包?????谢谢!!!
- 如何获取windows系统最大进程数量?
- 一个困惑我的Socket编程问题
- 我急需一个类似浩方 QQ对战平台那样的底层通讯的模块 (能支持udp协议,tcp协议,ipx协议)-可付费,有的请Q我
VS2005下,sizeof(std::vector<unsigned char>)等于20……实际上,sizeof(std::vector<unsigned char>)和你的vector中有多少元素并没有关系。