1 message in net.java.dev.jna.usersRe: RE : Re: [jna-users] WIN32_FIND_D...
FromSent OnAttachments
Timothy WallSep 13, 2007 4:42 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: RE : Re: [jna-users] WIN32_FIND_DATA mappingActions...
From:Timothy Wall (twal@dev.java.net)
Date:Sep 13, 2007 4:42:25 am
List:net.java.dev.jna.users

On Sep 13, 2007, at 4:54 AM, jean-michel T wrote:

Hi. Thanks a lot, I avoid the JVM crashes with your method now. Problem is I can't get java to give me the values in "cFileName".

When I do a system.out.printlln of my structure WIN32_FIND_DATA, I got :

" class [C cFileName@2c=[C@d1e604 class [C cAlternateFileName@234=[C@54172f

That's because they're char arrays. They need to be converted to String before they'll print properly.

but if I try to print : System.out.println("file Name " + Native.toString( (fileInfos [0].cFileName)[1]));

All I got is a "." or nothing depending on how I try to print the values.

I'm surprised that compiles. Try

Native.toString(fileInfos[0].cFileName);

Also make sure your Structure is declared within your library interface definition (which ensures that it gets the same type mapping options applied to it), and that you use char[] if you are using the unicode version of w32 API, or byte[] if you're using the ASCII version.