6 messages in net.java.dev.jna.usersRe: [jna-users] Reading string from U...
FromSent OnAttachments
Johan LundMay 15, 2009 6:46 am 
Daniel KaufmannMay 17, 2009 7:22 am 
Johan LundMay 17, 2009 8:19 am 
Johan LundMay 17, 2009 8:22 am 
Daniel KaufmannMay 17, 2009 9:17 am 
Timothy WallMay 17, 2009 9:17 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-users] Reading string from UnionActions...
From:Johan Lund (joh@risken.se)
Date:May 17, 2009 8:22:31 am
List:net.java.dev.jna.users

This is how I read stings and double's might be the problem!!?

public String getAdkStr(AdkLibrary.ADK_DATA adkData, int iFieldId){ if(getAdkType(adkData, iFieldId)==2){ IntByReference iLength=new IntByReference(); AdkGetLength(adkData, iFieldId, iLength); Memory mem = new Memory(iLength.getValue()); PointerByReference pref = new PointerByReference(mem); AdkGetStr(adkData, iFieldId, pref, iLength.getValue()); Pointer p = pref.getValue(); byte[] buffer = p.getByteArray(0, iLength.getValue()); return Native.toString(buffer); }else System.err.println("Wrong fieldtype, tried String."); return null; } public double getAdkDouble(AdkLibrary.ADK_DATA adkData, int iFieldId){ if(getAdkType(adkData, iFieldId)==4){ DoubleBuffer pdValue=DoubleBuffer.allocate(1); AdkGetDouble(adkData, iFieldId, pdValue); return pdValue.get(); }else System.err.println("Wrong fieldtype, tried Double."); return -1; }