javajnaerator

How to convert String value to Pointer<Byte> (Java, JNAerator)?


I have converted .dll library to JAR by using JNAerator. Now I need to call OpenTCPIPPort_V method which looks like this: public static short OpenTCPIPPort_V(Pointer<Byte > tcpPort, Pointer<Byte > IPAddr)

How to pass two string values to this method?


Solution

  • There is a function from a String class called getBytes. Here is an example:

    String example = "example, string";
    byte[] bytes = example.getBytes();
    

    What you need now is to put those byte[] values into your's Pointer. I think you can handle now.