How do I read two dimentional string object in C through JNI

HI,
I am new to JNI and Java as well. I want to read two dimentional string object passed by java to a native method written in C/C++. Say for example I have declared a two dimentional string object as below:
In Java
class InstanceFieldAccess {
private String [][] originalAddress = new String[][13];
private static native String [] accessField(String [][] referenceAddress);
public static void main(String args[]) {
/// Java code to get the string object and pass the string object to native method
new InstanceFieldAccess ().accessField(referenceAddress);
static {
System.loadLibrary("ReadStr");
In C/C++
I want to read the passed two dimentional string array in C/C++ native code and do the further processing and pass the string
back to Java class.
Could anybody tell me how to write the corresponding C/C++ native method.
Thanks in Advance.
Pramod.

i got it thanks.

Similar Messages

  • How should i read two counter through software of Ni 6602

    Hello all,
    i want to know that how should i read two counters same time of NI 6602  using c#.net.
    Please  guide me.

    Hello,
    I have a couple of suggestions for you to look into and determine which is best for you application. 
    -  Use a Two Edge Separation task to count ticks and not seconds (by changing the units) between a start and stop trigger.  The two trigger signals will need to come from different sources.  The KnowledgeBase (KB) linked below describes the task in further detail.  This KB explains why a reference trigger is not recommended.  Open up the C# example in the Measure 2 Edge Separation folder from the location listed in the previous post.
    AE KB 2IK8FRXA: How Do I Count Digital Edges Between a Start and Stop Trigger on an NI 6602 Counter/...
    -  Use an Arm Start Trigger as a start trigger with the Count Digital Event task.  It will only allow of a start trigger and not necessarily a stop trigger.  The Developer Zone link below provides a coded example. 
    Developer Zone: DAQmx - Event Counting on Multiple Counters with Digital Start Trigger (TIO) - LabVI...
    -  Use an Arm Start Trigger to synchronize multiple Count Digital Edge tasks and paired with Pause Triggers to pause acquisition based on source level. 
    Developer Zone: Synchronous trigger start of multiple counters and pause independently
    For more information on the type of triggers mentioned, refer to the DAQmx Help.
    Samantha
    National Instruments
    Applications Engineer

  • How to execute a method from String object?

    I have some methods in String objects, example:
    String methodOne = "someMethod1";
    String methodTwo = "someMethod2";
    public void someMethod1() {
    public void someMethod2() {
    How can i execute that methods, when the method names i have only in String objects?

    You can get the method directly from the name and parameter types if you want to avoid using the loop:public class Foo27 {
      public static void main (String[] args) throws Exception{
        String methodOne = "someMethod1";
        String methodTwo = "someMethod2";
        Object foo = new Foo27();
        Method method1 = foo.getClass().getMethod(methodOne, new Class[]{});
        method1.invoke(foo, null);
        Method method2 = foo.getClass().getMethod(methodTwo, null);
        method2.invoke(foo, null);
      public void someMethod1() {
        System.out.println("someMethod1");
      public void someMethod2() {
        System.out.println("someMethod2");
    }The parameter types are required as there could be more than one method with the same name.
    For somereason when I tried to create a new Method object and invoke it, an exception was thrownThere isn't a public constructor for Method, so how did you create a new one?
    Pete

  • How can I read two channels with fieldpoint and labview

    I'm trying to read two or more channels with the TC 120, and I follow the examples of sopport page, but doesn't work.
    What can I do?

    For more information about reading or writing to or from multiple channels in Fieldpoint, please refer to:
    How Do I Read or Write to Multiple Channels on a Fieldpoint Module in LabVIEW?
    This should enable you to read multiple channels. The only other option available is to use one fp open.vi, multiple Create Tag.vi's and multiple FP Tag Read.vi's.

  • Manipulating C++ Objects in Java Through JNI

    Hi,
    I have some existing C++ classes objects that I would like to access through Java methods. However, if I use a java method to create an instance of a C++ object, and then I want to edit the state of that C++ object through java, how do I reference the correct C++ object.
    For example, if I have a C++ object called Ball, with two variables x and y representing its position and a constructor as well as set methods to set x and y. I then make a java class Ball with the same variables, constructor, and setter methods. But when the java constructor is called, I want the C++ version to be created, and when the java setter methods are called, I want the x and y of the correct C++ Ball instance to change.
    Is this is possible, and if so what are the steps needed?
    Thank you

    See example with C++ structure in
    http://www.sharewareplaza.com/Java-Platform-Invoke-API-Demo-version-download_49212.html

  • How can I read an XML string that's not from an XML file?

    I've got a script I'm trying to setup that communicates over a socket to retrieve different directions from a custom built Java program.  The Java program listens to requests from the Adobe scripting engine (in my case it's a Photoshop script) on a socket and immediately responds with the next set of directions.  These directions are currently in XML format.  The issue I'm having is that I can't parse the XML data since it's entered into a new XML object from a string rather than being read from a file.  Even without the socket code, you can see the issue by doing the following:
    var xml = new XML("<test><data>hey!</data></test>");
    alert(xml.test.data);
    alert(xml);
    The first alert "should" return "hey!" (without quotes, of course), but it doesn't, while the second alert returns what you would expect it to:
    <test>
        <data>hey!</data>
    </test>
    It works fine if read from an XML file, but from a string, like shown above, it just presents an empty alert box when attempting to access "xml.test.data".  Any ideas on how to fix this issue?  Can it be fixed?  Has it been fixed in newer versions (I'm currently using CS4)?
    Thanks in advance for any help!

    Duh... found my error... I was attempting to access the data by referencing the created "root" element.  Since <test> is the very first element tag, it's setup as the root element, which you don't need to reference.  Changing the alert to alert(xml.data); fixed it.
    Now I just feel dumb, lol...

  • How to continously read for a string or word in a file?

    Hi
    I have been trying for a while now to search for a word that is being written to a file.
    I was wondering if anyone can get me over this hump?
    What I am doing is reading from the serial port to a file (example file called test), and while this is being done I want to search for the word "passed" or the phrase "test passed"
    Once I fine this word or phrase, I can stop the test
    I cannot figure out how to search the file, I used the scan file VI and the search/ replace VI etc with no luck!
    Your suggestions is appreciated

    It's always best to post your code so others can see the work you've done.  Suggestions will be more effective that way.
    So your reading from a serial port to a file?  What do you mean by this?  Are you reading from the serial port and writing the data to a file?  It's the file you want to read, isn't it?  If I had your code I could answer my own questions  
    Why don't you just monitor the incoming data stream from the serial port for "passed."
    But to read from a file and search for a string, Smercurio is correct.  Match Pattern will do what you need (You can use this same function for ASCII serial data as well).
    Reese, (former CLAD, future CLD)
    Some people call me the Space Cowboy!
    Some call me the gangster of love.
    Some people call me MoReese!
    ...I'm right here baby, right here, right here, right here at home

  • How can I read two double after typing?

    Hi everyone!!
    Thank you for reading me, I need your help.
    I'm new (very very new) in JAVA programming.
    I have a problem. I'm trying to write an application that reads a couple of
    numbers (double). It shows a message on screen that says something like
    'type a number', and then it reads it.
    The thing is that the program doesn't stop for the input of the second
    number and I don't know how to solve it.
    Can you help me please?
    My code is similiar to the following one:
    System.out.println("Type the first number: ");
              try{
                   x = System.in.read();
                   }     catch(IOException e){
                   System.out.println("It didn't work.");
    System.out.println("Type the second number: ");
              try{               
                   y = System.in.read();
                   }     catch(IOException e){
                   System.out.println("It didn't work.");
    // We build the point
    Point point1 = new Point(x,y);
    Thank you very much for your attention and help.

    You need to read the docs more carefully. read() just reads a single byte. If you type a capital 'A', read will return the number 65.
    Look at the java.util.Scanner class. I think it has a readDouble method.
    If you're not on 1.5 yet, use a BufferedReader around System.in to read a line, and then use Double.parseDouble.
    http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • How do I read the XML string using Http response/request?

    When my HTTP POST action is perform, the action will return me a XML string as shown in the link, https://www.neteller.com/gateway/netdirectv4.cfm?amount=150.00&net_account=458415554241&secure_id=896365&bank_acct_num=6789&currency=USD&merchant_id=1234&merch_transid=1102&merch_account=john123&custom_1=test123&custom_2=test123&custom_3=test123&test=1
    The above XML string will be send back by one of the payment gateway.
    How do I retrieve all the attribute name and value from the XML string so that it can be stored in my database?
    The XML string will be as shown below:
    <?xml version="1.0" encoding="ISO-8859-1"?><netdirect version="4.0">
              <approval>yes</approval>
              <amount>150.00</amount>
              <trans_id>403070</trans_id>
              <error>none</error>
              <fee>4.35</fee>
              <time>{ts '2006-06-23 06:14:19'}</time>
              <firstname>Test</firstname>
              <lastname>Test</lastname>
              <email>[email protected]</email>
              <custom_1>test123</custom_1>
              <custom_2>test123</custom_2>
              <custom_3>test123</custom_3>
              <dafee>0.00</dafee>
              <client_currency>USD</client_currency>
              <client_amount>150.00</client_amount>
              <merchant_currency>USD</merchant_currency>
              <merchant_amount>150.00</merchant_amount>
              <fxrate>1.0</fxrate>
              </netdirect>

    How about parsing the XML? Check out JAXP.
    http://java.sun.com/webservices/jaxp/index.jsp

  • How to read a MIME Repository Object in ABAP ?

    Hi all,
    How can I read a MIME Repository Object in ABAP code ?
    Thanks.

    Hi,
    check the package SMIMES, there you can find classes and function modules to acess the mime repository.
    Regards,
    CW

  • How can I read a column of numbers saved as .txt and display as a wave?

    Hi Tiano
    LabVIEW General
    Ask:
    Please enter a one-line summary of your question
    Resources
    • Technical Support
    • Development Library
    • Measurement Encyclopedia
    "data/time reading into chart"
    "In the attached file, I am trying to read the first column of data, and the next column is the value on the x-axis I want it plotted at. How do I read two columns of different data? I have looked in the books I have access to and the help within Labview but am still having trouble.
    Thank you,
    Ellie"
    data_set (Plain Text, 3K)
    -posted by Ellie on 9/11/2001
    markwysong on 9/11/2001 answered:
    "Ellie,
    The first thing you need to do is to read your file in as a spreadsheet file. Then, you display it in a chart.
    That sounds simple, but looking at your dataset, there's a few things you should know. First, the "read from spreadsheet VI" is looking for data in columns, like your data set, but columns separated by tabs. Therefore, your data must be saved that way; currently, it doesn't seem that it is. Another thing; you must skip the header portion (labels) of your file when reading.
    Next, it would be easier if your time was first, and your data was second in your columns, but that can be overcome. In the VI I am including, I have copied your data set into a file called data.txt, and I've removed the header and separated the columns with a tab. Then, I read in the data, and I break out each column so I can put the time first, and then I combine them again into a cluster so it can be displayed on an XY chart.
    Take a look!
    Mark"
    Graph data from file (Binary Executable, 20K)
    data.txt (Plain Text, 3K)
    This answer has not yet been rated.
    Rate this answer:
    Mikael Garcia on 9/11/2001 answered:
    "Ellie,
    Here is one way of doing it. Take a look at this example (compatible with LabVIEW 4.1 and up) and post comments if you need further help. Basically, I read your file as text; split it; and make use of the Spread sheet string to Array function before I plot your data. Hope this helps./ Mikael"
    ExtractAndPlot.vi (Binary Executable, 36K)
    This answer has not yet been rated.
    Rate this answer:
    Ellie on 9/12/2001 commented:
    "Thank you. I am trying to get the data from the text file into a string and am having some trouble. I am reading the file from a spreadsheet, and sending the output array to "Array to Spreadsheet String", but I'm not sure this is what I want to do. Is there another way to make an array into a string? Do I need to reformat my data?
    Can you offer me any advice?
    Thank you."
    data_1 (Plain Text, 3K)
    Mikael Garcia on 9/12/2001 commented:
    "I noticed that you changed your file format according to what was said here. Yes, this new file of yours is easier to use but your original file does not have to be changed. Take a look at this example. I now added the file-read part. It will give you a dialog to locate your data file (use this VI with your original file with the header since this VI includes a string split function). Hope this helps. /Mikael"
    ReadExtractandPlot.vi (Binary Executable, 35K)
    Niko on 9/12/2001 answered:
    "If you read this file with the "read from spreadsheet file.vi" you get you
    data in a 2-D-array. Now it is easy with array- and cluster-functions to
    handle the data the way you want.
    hope that helps, Niko"
    This answer has not yet been rated.
    Rate this answer:
    I intend to read from a .txt file that contains a column of numbers. After reading I want to display it as a waveform. In fact the numbers represent points along a waveform/graph of Flow vs. time. Thus I want to have this info in the chart or graph with flow in the y0axis and time in the x-axis. Can someone give me some detailed help please? Thank you in advance.
    Attachments:
    The_file.txt ‏18 KB

    All you have to do is use Read From Spreadsheet File.vi that's on the File I/O palette. For your example .txt, set the Transpose input to true and wire the First Row output to a waveform graph. The only problem I see is that since your file doesn't contain any sampling info, the time axis will be relative. If have that information elsewhere, then you can put a build waveform function between the read and the graph. Wire the First Row output to the Y input Build Waveform and add t0 and dt values. I've attached an example.
    Attachments:
    Graph_from_text.vi ‏29 KB

  • Read two different arrays and display

    I have a text file, which has 1000 of entries in the way mentioned below:
    Kozos customer
    sabze employee
    I am reading the content of text file and saving as an arrays.
    $global:Content = get-content info.txt
    $global:Name=$Content | foreach {
    $hashTab=@{Name="" ; Info=""}
    $hashTab.Name, $hashTab.Info=$_.Trim() -split '\s+'
    New-Object PSObject -Property $hashTab
    $global:Names=$ServerList | select -ExpandProperty Name
    $global:Infos=$ServerList | select -ExpandProperty Info
    How do I read two arrays, I mean read the values of two arrays one by one and display the result as:
    Names Infos
    Kozos Customer
    sabze employee

    We get that you are unable to do this, but it is still not clear precisely what it is that you want, a two-dimensional array, or a structure such as SeanQuinlan suggested? Also:
    there seems no reason for any of the variables to be global in scope.
    Where is the $serverlist variable defined?
    what relationship is there between the file you mention and the data in the $serverlist variable?
    Your code has three arrays, $name, $names, and $infos; which two of these do you want to combine into a single array? If $names and $infos, would this work for you:
        $namesNinfos = $serverlist | select name,info
    I suggest that you describe your situation without trying to state it in powershell (as that is partly where your problem lies). You could, for example, show sample content of the file and each of the two arrays, and show what this would look like in your
    desired two-dimensional array, perhaps like this:
    file info.txt
    Kozos customer
    sabze employee
    array 1:
    Kozos
    sabze
    array 2:
    customer
    employee
    resultant 2D array
    column 1 2
    row
    1 Kozos customer
    2 sabze employee
    As an aside, it could be that we are getting confused by the term "array". languages such as fortran and basic support multidimensional arrays in which each element is addressed by a set of integer indices, the most common form being row and column, as in
    a spreadsheet.
    In Powershell, arrays are generally one dimensional, with a single numerical index being used to select a single element ($row3 = $array[2]). That element can optionally have multiple values if it is defined as an array or a hash. This is referred to as
    a "jagged array" as each element of the array may not all have the same number of sub-elements as each other.
    Powershell also supports true multidimensional arrays, however, these seem fairly rarely used, I suspect because jagged arrays generally provide more easily used functionality.
    You can get more details on this from
    here and
    here.
    This, then, leads to my final question:
    what type of two-dimensional array are you looking for, and how will your script be processing it?
    Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.

  • Reading two data points at a time in Excel

    I would like some help on a programming issue:
    I know how to read whole excel data sets but how do you read two points at a time?  I would like to extract a number from row 1 column 1 and row 1 column 2.  I will use these numbers simultaneously as for loop counters.  Then the program should read row 2 column 1 and row 2 column 2.  This pattern should continue (number of times unknown) until the two numbers both equal 0.
    Please help me with any suggestions you have.
    Thanks ahead of time!

    Hi mtcellar65
    1. you know how to read the whole excel data -  just read the 2D Array (whole information)
    2. extract the single elements using 'Index Array' Function.
     the index for row and column can be kept in a shift register.
    3. increment the indices and repeat step 2 again
    hope this helps
    Renn
    Kudos always welcome for helpful posts

  • Read the text in object LFA1 with ID Z001

    Hi Guys,
    Can u please suggest me how can i read the text in object LFA1 with ID Z001.
    Actually my requirement is i have service agent in my internal table.
    Z002 is the current pro number..that is ready to use after using that update that current pro # Z002 with the next available in the range...(i.e Z001)
    Z001 contains range of Pro number.,. like 848 477 250 to 848 477 740
    asume you used the # 848 477 250 in one shipment, update the Z002 with the second one 848 477 251
    Can u please suggest me this how can i develop. Just send me the suggestions plese i will do that coding. Lookingforward your kind co operation.
    Regards,
    Ravi

    Basic call to function is as follows:
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        id                            = 'Z001'    "Text ID = 'Z001'
        language                      = 'E'       "English
        name                          = 'LFA1'    " Not sure if this is correct
        object                        = l_vendor  "Vendor with leading zeros
      TABLES
        lines                         = l_output   "Table of Structure  TLINE
    EXCEPTIONS
       ID                            = 1
       LANGUAGE                      = 2
       NAME                          = 3
       NOT_FOUND                     = 4
       OBJECT                        = 5
       REFERENCE_CHECK               = 6
       WRONG_ACCESS_TO_ARCHIVE       = 7
       OTHERS                        = 8.
    I am not sure I have the name and object exactly right - If you display one of the texts in the old style editor and use menu option Goto-->Header you can see these values.  Alternatively look in table STXH for text headers to see how the key is constructed.
    Andrew

  • Reading in a String

    Hi,
    I'm currently attempting to write my first java console application and have several questions I hope someone out there would be able to answer:
    1. How do I read in a String and store it so I could use its value elsewhere?
    2. How do I read in a Character and store it so I could use its value elsewhere?
    3. How on earth do you use a boolean data type with an if-else loop?

    To read a character u say:
    char chr=(char)System.in.read();
    to read a string u say:
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    or
    InputStreamReader isr=new InputStreamReader(System.in);
    BufferedReader br=new BufferedReader(isr);
    and finally u say
    String str=br.readLine();
    u may use these values of chr and str as u see fit
    vijay

Maybe you are looking for

  • How do I put the songs on my iPod onto my iTunes

    I put iTunes onto my laptop and want to put my songs from my iPod onto my iTunes, how do I do this or do I have to rip my cds again to put the songs onto iTunes?

  • File problem - checking the existence of a remote file

    I have absolute paths to several text files from a ftp server (which don't require any authentication and can be accessed over the internet). I am trying to write a Java method that can check any of the above absolute ftp file paths and returns true/

  • Can't shut mail in infinite loop

    I can't shut my mail account, and I cannot turn my mac air off.  Has anyone else had this problem?

  • VGA and S-video

    Can I use both a VGA device and a S-Video device at the same time? Anyone know of a workaround on this?? Thanks!!

  • Store Print Output config in user presets

    Hi, I use the 'print to jpg' option to prepare shots for submitting for external printing, and save the different output formats in user templates (e.g. '8x12 with 3mm border'). BUT, the user template does not seem to store the jpg ouput details - th