This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The type to which you refer is not a standard "C" type. It must be a typedef. It looks as if it is probably actually an unsigned 8-bit integer, or byte.
How to represent this in Java depends on what you need to do with the data. I didn't look in detail at your posted code, but perhaps what you really have is text (a zero-terminated array of unsigned 8-bit integers could represent a text string). In that case, java.lang.String might be best. Alternatively, to treat each integer as a separate piece of data, you could use the Java "byte" class (but remember it's signed - that doesn't matter in many operations, but could be crucial in some) or perhaps Java "char" (but remember Java characters are Unicode).
Probably, rather than try to do a direct line-by-line port of the "C" code, you should step back, work out what it does, and re-code in Java.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joined: Nov 13, 2004
Thanks for your quick answering! Yes, I had already code it in java, but what happens is that some characters are not being well calculated... This code above should be used to generate a key string form a lock string. For example I�ve written the following code in java:
For this lock: passed to the function I receive this key: , but I should receive this one: These are the invalid characters: Position i:19 -> correct='�' (8216) java_code='?' (145) Position i:24 -> correct='�' (8218) java_code='?' (130) Position i:41 -> correct='�' (8211) java_code='?' (150) Position i:45 -> correct='�' (8217) java_code='?' (146) Position i:48 -> correct='�' (8226) java_code='?' (149) Position i:58 -> correct='?' (65533) java_code='?' (129) Position i:64 -> correct='?' (65533) java_code='?' (129)
So I think that this must have something to do with the "char" so I�m trying to use that "u_int8_t" form that c++ code...
Best regards, Daniel Botelho
Joined: Nov 13, 2004
Is there any class in java that those the same thing that u_int8_t from C?
Best regards, Daniel Botelho [ January 11, 2005: Message edited by: Daniel Botelho ]