import ctypes
import struct
class _sPOS(ctypes.Structure):
_fileds_ = (
("POSX", ctypes.c_double),
("POSY", ctypes.c_double)
)
sPOS = _sPOS()
class _sPOSE(ctypes.Structure):
_fileds_ = (
("sPOSX", sPOS),
("sPOSY", sPOS),
("sDirection", ctypes.c_double)
)
with open('/Users/machcross/Desktop/MasterDB_03M17D15H34m54s.dat','wb') as f:
sPOSE = _sPOSE()
sPOSE.sPOSX = 0.1
sPOSE.sPOSY = 0.2
sPOSE.sDirection = 0.01
size = ctypes.sizeof(sPOSE)
print(size)
如何获得SPO的大小? len(sPOS)不工作。。 ctypes.sizeof(sPOS)为零
我想知道怎么做bytearray(sPOS)因为。。 例如)buf=((char*)&_sPOS,sizeof(sPOS))
目前没有回答
相关问题 更多 >
编程相关推荐