Propagating changes from C into Java

I need to interface to an existing library of C functions which have the property of input parameters being used as output.
IE a C function may have the signature: int NWDS_PING(char node, NWDS_ITEM_LIST item_list).
The string node is used both as input and output for the function with the int return type indicating status of the request. My problem lies in that I need the java String passed into the native method from my java function to be altered to whatever it is modified to in the C process.
Any ideas on how to do this?
Thanking you kindly,

Hi,
* you can use a Stringbuffer or
* you can use a byte array
(but no String)
1. In Java fill the parameter of your choice with your input string and
pass it to the native method
2. Collect the input string in your JNI function into a newly created
char[] and pass it as char * in the call to the C function
3. After return in your JNI function copy the result back to
the parameter. Free your char[].
That's it.
Have fun,
Klaus

Similar Messages

  • Sql is not working after changing from MsAccess into sql server

    Following Sql  is not working after changing from MsAccess into sql server. 
    sum(trn.sales) as sales,
    sum(trn.cost) as cost,
    sales - cost as profit // Here is not working . can we not use sales a column. Please advise
    from trn
    Kind Regards
    pol
    polachan

    It will not work if use two different column from the table or column  from two  different table
    Example
    sum(trn.sales * trn.rate) as salesAmount,
    sum(trn.cost) as cost,
    sum(trn.salesAmount)-sum(trn.cost) as profit ----- Here is not working . can we not use sales a column. Please advise
    from trn
    Regards
    polachan

  • I have just bought a mac and also have windows installed but how do i change from windows into mac?

    I have just bought a mac and need to know how to change from using windows into Mac. When the mac starts up windows come up but i want to use Mac?

    To set the default boot volume use the Startup Manager system preferences once you are booted back into the OSX.  Then you would only need the option key at boot time to boot into the "other" OS.

  • Documents in library went from English to Java Script

    The documents in my libraries was all in English,
    This changed from English into Java Script, Java Script Run Errors, and left some documents in English.
    I'd like my library/document file back in alphabetized English only

    Hello anitaworkman,
    I understand that your files have changed to java script.
    Open up command prompt and run the following command SFC /scannow.
    This will scan the system files and correct any errors that it can.
    Here is a link to command prompt.
    When you go to open command prompt, right click and run as administrator.
    If it has not been to long since the problem started, you can run a system restore.
    This will take the system back to when everything was working correctly without affecting your personal files.
    Here is a link on how to do a restore.
    Let me know how everything goes.

  • Urgent Help Changing C code to Java!

    Hi can anyone help me please !
    I need to change the following code from C into Java!
    The Project has to be done by this the Friday 26th April
    < Code in C>
    int textToBmsg(char abuf ,char bbuf,int bbufsize)
    /*takes a text message in 7 bit ascii and converts it to
    *a compressed 8-bit format.
    *return-size of output string
    int aidx; /* index into input string */
    int bidx; /* index into output string */
    int i;
    int c;
    char tmp[SMSTEXTSIZE];
    aidx=0;
    bidx=0;
    while(*(abuf + aidx) != 0 && bidx < bbufsize){
    c = *(abuf+aidx) & 0x7F;
    switch (aidx%8){
    case 0:
    *(tmp + bidx)= c;
    break;
    case 1:
    *(tmp + bidx) |= (c & 0x1)<< 7;
    bidx++;
    *(tmp = bidx) = c >> 1;
    break;
    case 2:
    *(tmp + bidx) |= (c & 0x3) << 6;
    bidx++;
    *(tmp + bidx)= c >> 2;
    break;
    case 3:
    *(tmp + bidx) |= (c & 0x7) << 5;
    bidx++;
    *(tmp + bidx)= c >> 3;
    break;
    case 4:
    *(tmp + bidx) |= (c & 0xF) << 4;
    bidx++;
    *(tmp + bidx)= c >> 4;
    break;
    case 5:
    *(tmp + bidx) |= (c & 0x1F) << 3;
    bidx++;
    *(tmp + bidx)= c >> 5;
    break;
    case 6:
    *(tmp + bidx) |= (c & 0x3F) << 2;
    bidx++;
    *(tmp + bidx)= c >> 6;
    break;
    case 7:
    *(tmp + bidx) |= (c & 0x7F) << 1;
    bidx++;
    break;
    aidx++;
    if ((aidx%8)!= 0 )bidx++;
    itoh(aidx, bbuf, 2); /*length of umcompressed message*/
    bbuf += 2;
    for(i=0; i<bidx; i++){
    itoh(*(tmp+i), bbuf, 2);
    bbuf += 2;
    return bidx*2 + 2;
    </code>
    Tks.in advance,
    HendyJDK

    Thanks for nothing you sad individual, if you ar not
    going to offer anything constructive then please
    keep your opinons to yourself, if you must know I
    stuck for time and trying my best to translate this to
    meet a deadline this Friday, you pompous idiot! Requesting that you refrain from cross-posting isn't pompous and doesn't identify the person who
    makes the request as an idiot. As a matter of fact, he was pointing out that your question was
    answered in the other posting that you made.
    Rather than responding in the manner in which you did, you should have thanked him for his help!
    Mark

  • DnD from Outlook to Java.  Any ideas?

    Naive novice here.
    I would like to drag and drop from Outlook into Java app.
    Can this be done?
    If so how might I go about it?
    Any help/information/pointers is appreciated.
    Mick

    hm, its possible to detect the drop from native apps e.g.
    import javax.swing.*;
    import java.awt.dnd.*;
    import java.awt.datatransfer.*;
    public class MickNBT {
       public static void main(String [] arg) {
          JFrame frame = new JFrame("MickNBT");
          JLabel label = new JLabel("Drag to here");
          new DropTarget(label, new DropTargetAdapter() {
             public void drop(DropTargetDropEvent dtde) {
                Transferable t = dtde.getTransferable();
                System.out.println(dtde+"\n"+t);
          frame.getContentPane().add(label);
          frame.pack();
          frame.show();
    } but i'm not sure how you get the information associated with the drop event. I think it has to be a MIME type for you to have a chance of using it but could be mistaken..
    hopefully someone knows more about this part of the operation :)
    asjf

  • How to read some records from a text file into java(not all records)

    hello,
    how to read text files into java. i need only few records from the text file not all records at a time.
    If any one knows plz reply me
    my id is [email protected]

    this snipet reads a text file line by line from line 1 to 3
    try {
                  FileReader fr = new FileReader(directory);
                  BufferedReader br = new BufferedReader(fr);
                  int counter = 0;
                  while ((dbconn = br.readLine()) != null) {
                      switch(counter){
                          case 0:
                            status = dbconn;
                          break;
                          case 1:
                            userName = dbconn;
                          break;
                          case 2:
                            apword = dbconn;
                          break;
                      counter++;
                  br.close();
        }catch(IOException e){
        }

  • How can i use JWSDP1.6 from Ant tool to convert .wsdl file into Java class

    Hi All,
    i m very new in the development field.plese help me...
    i have a .wsdl file and i have to make some modification in the file and return this file with build file used in Ant tool.
    means my requirement is to conver the .wsdl file into java class,modify it and convert back to wsdl file.how can i do it using JWSDP1.6 and Ant tool.
    thanks in advance...
    Vikram Singh

    lemilanais wrote:
    hello!
    I have developpe an animation with flash. before give it to othe person in order to use it, i would like to secure it by integrated a security module inside the software.Secure it from what? Being played? Copied? Deleted? Modified?
    Because, i am a java developper, i have choose Netbeans 6.1 to secure it.That has to be the most random thing I've read in some time.
    do you know how can i do to integrate my animation .swf inside my java class?Java can't play SWF files and Flash can't handle Java classes, so what you're suggesting here doesn't make a lot of sense.

  • How do I change from sync to iTunes to sync with iCloud if I don't have my computer available to plug into itubes

    How do I change from sync to iTunes to sync with iCloud if I don't have my computer available to plug into itubes

    Hello Rsd841979,
    Thanks for using Apple Support Communities.
    It's not very clear to me what you're trying to accomplish with iCloud, but if you want to start backing up to iCloud, then you can follow the directions in the article below.  If this is not what you are trying to do, then please let me know what you're wanting to use iCloud with.
    iCloud: Back up your iOS device to iCloud
    Take care,
    Alex H.

  • I've just changed from a PC to a mac and have a large number of downloaded WMA music files (not i-tunes purchases) which I just can't get into my i-tunes library. File converters don't seem to work either. Any ideas?

    I've just changed from a PC to a mac and have a large number of downloaded WMA music files which I can't get into i-tunes. When the library was in Windows, i-tunes would convert the files automatically, but this doesn't happen now. I've downloaded a couple of file converters, but these don't seem to work either. Any ideas?

    iTunes for Windows (but not iTunes for Mac) can import and convert unprotected WMA tracks. If the tracks are protected by DRM (Digital Rights Management) then it will not accept them.
    One option would be to install iTunes on your PC, do the conversion, and then transfer the converted tracks from iTunes on your PC to iTunes on your Mac.

  • Open Photoshop image from PDF into Photoshop and change cmyk text to 100% black

    when I have a supplied PDF file that has cmyk text, I open the image in Photoshop but I don't know how to change the cmyk text (some very small and some large) to 100% Black. I used to know the short cut key to do this but I can't remember. I used to use the marque tool then use a short cut key that would knock the cmy out of the k. Can some one please tell me how I can achieve this in a flattened photoshop file opened from PDF into Photoshop. Thanks

    One way to do this:
    Use a hue/saturation adjustment layer, click the Colorize box and drag the Lightness slider to -100. The black will go to C:0, M:0 Y:0, K:100. I'm not aware of a shortcut for this, perhaps someone more informed could help there. You would only want to apply it to the text, clipped to a separate text layer ideally, but if your file is already flattened you could apply it via a selection/masking.
    Mike

  • Problems realted to changing the language for non-Unicode programs from one into anther.

    Hi,
    Hi everyone!
    Product Name: HP Pavilion dv6-6093ex
    Product Number : LM610EA#A2N.
    My Windows 7(464Bit) Ultimate,  and its base language, and display language is English.
    The Languages(English, French and Arabic) built-in (came re-downloaded and re-installed by the person who made the Windows disc installation). Thus, while installing Windows 7, those three lanauge listed for me to choose one of them to be the base language
    and display language, I have chosen 'English'. In the End of installation, there are three pre-packaged languages(English and French and Arabic) can be used as a display language.
    I would like anyone kindly to confirm for me why I have been facing these problems when changing  language for non-Unicode programs from English into Arabic.
    First: After I have installed the  AMD High-Definition Graphics Driver (sp55092) 8.882.2.3000 on my laptop. The contents of the of Intel Graphics and Media Control Panel are partially shown in Arabic while language for non-Unicode programs
    is Arabic, however, they are completely shown in English while language for non-Unicode programs is English.
    A: I found that contents of the of Intel Graphics and Media Control Panel are partially shown in Arabic (second screen shot below, however,
    when click on any options, for example 'Graphics properties' shown in Arabic in, the second window is shown in English) while language for non-Unicode programs is
    Arabic, and it doesn't matter what format or location is.
    B- when I changed language for non-Unicode programs into 
    English.
    I found that contents of the Intel Graphics and Media Control Panel are completely shown in English .
    Second:
    A- Only All Arabic contents will be displayed encryptely while language for non-Unicode programs is English
    B-  All the Arabic contents are displayed properly   while language for non-Unicode programs is  Arabic.
    Third: an error extracting drivers and software downloaded from official HP website while language for non-Unicode programs is English.
    A-  I noticed an error extracting all kinds of comprised files(drivers and software) downloaded from HP website while language for non-Unicode programs is English and whatever location and format are:
    B- However  while language for non-Unicode programs is Arabic, there is no error extracting files.
    In conclusion, Is it normal
    for all of you the contents of the of Intel Graphics and Media Control Panel are partially shown in your native while  language  used
    for non-Unicode programs is your native lanague, however, they are completely shown in English while language for non-Unicode programs is English?.  IF so I would be saying that if I have wanted the  contents of documents written in my language
    Arabic to be shown properly, then then I
    must let the language for non-Unicode programs be Arabic.
    Is this happens with you as well?
    Also, if I need extracting all kinds of comprised files(drivers and software) downloaded from HP website, then language for non-Unicode programs
    must be in my Arabic lanague English and whatever location and format are.
    Is this happened with you as well?
    I would highly appreciate any clarification from you.
    A man should convert his anger and sadness into strength to continue living in this life.

    Hi,
    I am confused about your issue.
    when you changed language for non-Unicode programs into  English, it show English.
    while language for non-Unicode programs is Arabic, it show Arabic, If it's none-Unicode.
    This is correct. Why you think it's an issue?
    About your second scenario description, I was not clear what you said. Could you give us a explanation?
    Note: System display language is not the un-Unicode program language.
    You can just choose one language to display the system at same time.
    This article might be helpful to you:
    Install or change a display language
    http://windows.microsoft.com/en-in/windows7/install-or-change-a-display-language
    Change the system locale
    http://windows.microsoft.com/en-in/windows/change-system-locale#1TC=windows-7
    Karen Hu
    TechNet Community Support

  • I am living in moscow, but i have a mastercard in vietnam. I changed my location in itunes from Russia into Vietnam. But when I change my billing info, and write my card's informations. It said I have problems with the address. I typed my address in VN.

    I am living in moscow, but i have a mastercard in vietnam. I changed my location in itunes from Russia into Vietnam. But when I change my billing info, and write my card's informations. It said I have problems with the address. I typed my address in VN. What should I do now ????

    To answer the second question first, the owners of the music (and that is not Apple) decide where their music can be sold. If they decide (for whatever reason) not to sell their music in a particular country, they will not let a music retailer (that is Apple this time) sell it in that country. So the "system" is beyond Apple's control.
    As for your first post; (if I understand you correctly), the iTunes Store knows that you are in Russia, so using a credit card registered in Vietnam is simply going to look like you're trying to get round the system.
    The credit card is tied to an address, and therefore to a country. Simply using a different country's address is not going to work.
    By the way, this is a world-wide situation. It's not a matter of having to use a Russian card, whatever card you use has to be registered at an address in Russia.
    Use the support link in the iTunes Store to contact Apple and see if you can straighten out whether you can buy songs, where ever you are and with whichever card you have.

  • How To change UME Data source from Abap to Java.

    Hi Experts,
    Can any one give me Detailed Steps of how to Migrate from UME Data Source from Abap to Java, as the Ume Data Source is initally configured for Abap.
    Regards,
    Siva

    Siva,
    Please search before you post a question.
    This has been discussed many a times in here. Please refer to this [thread|To change ABAP UME database to Portal database;.
    Good Luck!
    Sandeep Tudumu

  • Photos recently changed from sequential numbering to date/timestamp.  When I import into apps for editing they are out of order.  What can be done to change back to sequential numbering instead of date/timestamp?

    Photos recently changed from sequential numbering to date/timestamp.  When I import into apps for editing they are out of order.  What can be done to change back to sequential numbering instead of date/timestamp?

    The date information is taken from the camera which writes it to the file. This needs to be set to the correct date and time in the camera itself.
    The order the images are shown in the Library mode is set by clicking on the sort button in the tool bar, which if not showing can be activated from view, tool bar. There are different sort orders that can be applied including sorting by file name. You can also sort by dragging the images to the order you wish them to appear in by selecting user order.

Maybe you are looking for

  • Does firefox has the clip feature that internet explorer has for clipping a article and pasting it to a document.

    internet explorer (my os is win 8) has a feature that allows the user to clip and article and paste it to a document, does mozilla has the add on comparable to this, if so where is it and how do I acquire it.

  • Secondary Site in DMZ on Workgroup Server

    Hi Guys, I have a simple question. Is it possible to install the role secondary site server on a server in the DMZ which is only in a workgroup (no AD!) or is AD a prerequisites for the installation? Greetings Chris

  • XSS NW04s and ERP2004

    Hi, We have a system landscape with NW04s portal running on WAS 7.0. The backend system is ERP 2004. We are now implementing MSS/ESS and according to Note: 1007341 our system landscape require a WAS 6.40 java stack with the XSS packages installed. We

  • Unable to read a cd content

    I was sent a copy of a cd.  I saw the contents  of the CD on another computer but my MacBook Air does not see any content. Why?

  • UIX/Struts+BC4J Comparision

    In one project, I'll develope a Thin-client Web-based appliation, this is my hypo architecture: 1. JSP+Struts+Tomcat+Oracle 9i 2. JSP+UIX+BC4J+Tomcat+Oracle 9i, I'm a newbie to Oracle UIX, can anybody give me suggestion about the comparision between