2 messages in net.java.dev.jna.usersRe: [jna-dev] encoding problem
FromSent OnAttachments
Timothy WallMar 18, 2008 5:27 am 
Timothy WallMar 18, 2008 9:44 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-dev] encoding problemActions...
From:Timothy Wall (twal@dev.java.net)
Date:Mar 18, 2008 9:44:22 am
List:net.java.dev.jna.users

Lucky Luke, please direct your messages to use@jna.dev.java.net.

On Mar 18, 2008, at 9:25 AM, LUCKY LUCKE wrote:

Then i modified the System.out......(newByte[j]+" ") so as to be System.out........((char)newByte[j]+" ") and got

x ? x ?

which is the same as the output of the Native.toString(newByte) thus meaning that x equals 120, = 1 or 2, and ? = -5. Sometimes i have the solution before my eyes, however im not able to just see it.

Try "man ascii" on a linux box to see character mappings for the ASCII set.

I still have crashes every time i try to write to the card. Is '\n' identifying the end of a string am i right?

Native strings are terminated with '\0' (a zero byte). '\n' is a newline. I don't know what your native library is expecting as a terminating character; it may be expecting \n between multiple commands, or some zany C programmer may have decided that '\n' was a better terminator than '\0'.

JNA automatically appends a zero byte to any String converted to a native string.