give you a good solutionyou could search google.com for ASN.1,this is a technique for solveing different language using socket to make communication
解决方案 »
- 读写流我把byte数组长度设置成1000或2000时得到的文件总出错
- try catch finally执行的疑问
- 求高手相助,二次曲线与二次曲线的求交算法。
- 一台机器上两个UDP端口都为0不会冲突吗?
- 有没有java多线程下载的例子!?
- swt中如何实现label鼠标拖动位置?
- 简单的问题:请教熟悉JCreator的朋友
- UML(Unified Modeling Language)是什么语言?它与面向对象语言有什么联系吗?
- 或许对你也有用,进去看看吧:关于怎样清除IE缓冲的问题!
- 在JB中工程的后缀,JPR和JPX有什么不一样?谢谢
- 100分,谁先答了,就拿去
- 汉字输出问题,在线等待,问题解决就给分!
up
DavidBone(7级宝宝)的solution要money
then parse your byte array. for example, if you want to convert a 32bit long(in c)
to long(in java), please use the following code://let offset to corrent positionlong tmpLong += ((int)line[offset] & 0x00FF);
tmpLong += ((int)line[offset+1] & 0x00FF) << 8;
tmpLong += ((int)line[offset+2] & 0x00FF) << 16;
tmpLong = ((int)line[offset+3] & 0x00FF) << 24;
for general data strcuture representation.
但是遇到汉字就比较麻烦了,
而字段间是顺序存放的,所以可以顺序方式来存取。
但是java的byte是双字节的
谢谢
[email protected]
但是我的思路是:
1。将你的数据结构(你的struct) 写成xml形式,然后用java来解析它。
2. 这种方法还要土,我不知道你有没有看thinkinjava中的那“垃圾收集器”程序,它里面就是用一个类自动装载的方法来解决了问题。你可以自己先事先写好用来接收C的几个类,然后在接收时动态的装入这些类。供你参考