Yuvaraj Athur Raghuvir wrote:
I want to send a C++ long long type as a binary representation over a
socket and read it on the J side. I see that the 3!:4 is limited to 4
byte integer conversion on 32 bit platform.
Can I use 3!:5 instead?
Or?
Regards,
Yuva
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
If you need the full 8 bytes of data, you can keep your data as two 4 byte
integers. If your long longs are representable by 4 byte integers, then you can
read them as literal characters and convert them using something like (assuming
standard byte order):
hdr=. _8}.(2) 3!:1 (2-2)
3!:2 hdr,data
Samples:
3!:2 hdr,8#255{a.
_1
3!:2 hdr,(6#255{a.),2#10{a.
_62966
3!:2 hdr,((3#{.a.),1{a.),(3#{.a.),1{a.
|limit error
| 3!:2 hdr,((3#{.a.),1{a.),(3#{.a.),1{a.
3!:2 hdr,((3#{.a.),0{a.),(3#{.a.),1{a.
1
--
David Mitchell
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm