C++代码是:
unsigned short* ui=(unsigned short*)&buf[110];
CountDev=ui[0];
Run Code Online (Sandbox Code Playgroud)
buf byte[]和CountDev是unsigned int
(BCB6编译器x86)
我的尝试是:F#
...CountDev = System.BitConverter.ToInt32( [| arrayRead.[110]; arrayRead.[111] |] , 0 )
Run Code Online (Sandbox Code Playgroud)
C#
...CountDev = System.BitConverter.ToInt32( [arrayRead[110]; arrayRead[111]] , 0 )
Run Code Online (Sandbox Code Playgroud)
但严重的是我无法确定.检查我的尝试,告诉我,如果我做错了请.
您可以使用:
... = System.BitConverter.ToUint16(arrayRead, 110);
Run Code Online (Sandbox Code Playgroud)
但它确实依赖于大/小端(数组中字节的顺序).
您将需要该规范或良好的测试用例.
| 归档时间: |
|
| 查看次数: |
283 次 |
| 最近记录: |