Jump to content
Excelsior Forums
cgabes

Byte array as input

Recommended Posts

I saw the question about  byte arrays as arguments.  The posted solution was for byte array as an output.  I have the other side of this problem.  How do I pass in a byte array to a C function?  

When I convert to a char array, the unprintable characters (outside of the standard ascii type) get lost and my resulting array is garbage.

Can I create an integer array using the int value of the byte and pass that?

Thanks in advance for the help.

Share this post


Link to post
Share on other sites

I found my solution.  For anyone wanting to know... here is how the conversion is done...

char[] charArr = new char[image.length];

for (int i = 0; i < charArr.length; i++) {

   charArr = (char)(image & 0xFF);

}

args[2] = Pointer.create("char*", charArr);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×