Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

passing string value from java to .exe file

Wed Oct 22, 2008 1:08 am

Dear All,

I'm having a problem to pass values from .class file to .exe file.
perhaps I search all corresponding dll files but I can able to know
the function. but I don't know how to pass values, I keep on searching
If anybody did such type of enhancement pls guide me



Re: passing string value from java to .exe file

Wed Oct 22, 2008 1:09 am

Do you know JNI? This will let you interface Java to C/C++. If the .exe
file already exists, JNI will help put the String in a format that can
be sent across.

The other thing is to realize what a C/C++ string is an array of
characters (same as Java bytes) followed by \0

So,
Code:
char *test = "abcde";


is the same as
Code:
char *test = malloc (6);
test [0] = 'a';
test [1] = 'b';
test [2] = 'c';
test [3] = 'd';
test [4] = 'e';
test [5] = '\0';


Use the getBytes () method of String to get a byte array representation
of the String, and then add on the character \0. C will recognize this.

Post a reply
  Related Posts  to : passing string value from java to .exe file
 Passing arrays as function parameter in java     -  
 Read file content to StringBuffer String object     -  
 Copy file to file in java code- implementation     -  
 Array Passing     -  
 Passing a Reference Variable     -  
 Passing an Argument to a Function by Value     -  
 JSP Passing Arrays to Methods     -  
 Passing Pointers to function example     -  
 How to remove special characters from a string in Java?     -  
 Passing Enum as Type Parameter to method     -