Python  에서  C/C++ 의 singed short data type 구하기.




 
import ctypes
ctypes.c_short(0xfc19)
ctypes.c_short(0xfc19).value
 
>>> import ctypes

>>> ctypes.c_short(0xfc19)
c_short(-999)

>>> ctypes.c_short(0xfc19).value   # 부호있는 short
-999

>>> ctypes.c_ushort(0xfc19)   # 부호없는 short
c_ushort(64537)

>>> 0xfc19
64537



*** ctypes 참고 :  http://python.net/crew/theller/ctypes/tutorial.html



Posted by 자유프로그램
TAG