I am trying to call a C ++ DLL in Java. Its main C ++ file has the following lines:
#define a '102001' #define b '102002' #define c '202001' #define d '202002'
What data type is for a, b, c and d? are they char or char an array? and what is the corresponding data type in Java that I have to convert to?
As noted in Mysticial , these are multichannel literals . Their type is implementation dependent, but it is probably Java longbecause they use 48 bits.
long
In Java, you need to convert them to longmanually:
static long toMulticharConst(String s) { long res = 0; for (char c : s.toCharArray()) { res <<= 8; res |= ((long)c) & 0xFF; } return res; } final long a = toMulticharConst("102001"); final long b = toMulticharConst("102002"); final long c = toMulticharConst("202001"); final long d = toMulticharConst("202002");
I can try to answer the first two questions. Not familiar with java, I have to leave the last question to others.
C. , , , , (, ASCII "a" , 97).
, , , , 0.
, , C , , , abc "abc" . , "abc" , , 4 (a, b, c \0), "abc" . C " , - a, b c.
1.4 "C "