I am converting/migrating a good old clipper xbase program to Java. As the old program is still running, I need to be compatible, when writing data in Java to the databases. It works really well, until now.
For that I need the functions i2bin and bin2i from clipper to be running in Java.
See here for i2Bin: http://www.marinas-gui.org/projects/harbour_manual/i2bin.htm
I can read the clipper written i2bin data with: cData is a String containing the an int coded as char beginning after first char:
char [] array = cData .substring(1).toCharArray();
int nLen = (int) array [0];
But I can not write a correct int coded as char in Java. So I got a
int len = 8;
char clen = (char) len;
and I get a '\b' but with only one character. The clipper function bin2i can not interpret it correctly. If I add a space to the char
String data = clen + " "
I get the right length for bin2i but it is not the length 8 anymore. Maybe it is coded via Ascii 32?
Anyway, how can I do it right?
regards, Peter