Read variable from c++ applicatio​n

I would like to do this but I don't know how it could be done: (the Labview will run parallel with c++ application and read the variable from the c++ application)
Thank you for your help.

"XN" <[email protected]> wrote in message
news:[email protected]..
> I would like to do this but I don't know how it could be done: (the
Labview will run parallel with c++ application and read the variable from
the c++ application) Thank you for your help.
There are several ways. You'll have to describe your application more if you
want a recomendation about the prefered method. For instance, is it a
command line application? Do you have the source code? How much data is
there to transfer (bytes, kB, MB? per second). Do you want to poll this
value, or do you need to get a notification if the value is changed? Etc.
Some ways to do this:
Through the command line (using pipes in LabVIEW).
With a TCP/IP connection.
Memory mapped files.
File sharing.
Windows messaging system.
Regards,
Wiebe.

Similar Messages

  • Read variables from XML

    Is it somehow possible to read variables and values from xml into an PowerShell script without specifying each of them separately?
    For example I've set the following variables:
    $arrPostcode @()
    $arrPostcode += ,@('1234AB', 'City1')
    $arrPostcode += ,@('4567CD', 'City2')
    $blnHome =$True
    $blnNld =$False
    $intNumbers =556
    $strText ='Something'
    And I have a xml file like (can be ajusted when required to get a better result):<?xml version="1.0"?>
    <Objects>
    <Object Type="System.Management.Automation.PSVariable">
    <Property Name="Name" Type="System.String">arrPostcode</Property>
    <Property Name="Value" Type="System.Object[]">
    <Property Type="System.Object[]">
    <Property Type="System.String">9874ZX</Property>
    <Property Type="System.String">City5</Property>
    </Property>
    <Property Type="System.Object[]">
    <Property Type="System.String">6541UH</Property>
    <Property Type="System.String">City3</Property>
    </Property>
    </Property>
    <Property Name="ModuleName" Type="System.String" />
    </Object>
    <Object Type="System.Management.Automation.PSVariable">
    <Property Name="Name" Type="System.String">blnHome</Property>
    <Property Name="Value" Type="System.Boolean">False</Property>
    </Object>
    <Object Type="System.Management.Automation.PSVariable">
    <Property Name="Name" Type="System.String">blnNld</Property>
    <Property Name="Value" Type="System.Boolean">True</Property>
    </Object>
    <Object Type="System.Management.Automation.PSVariable">
    <Property Name="Name" Type="System.String">intNumbers</Property>
    <Property Name="Value" Type="System.Int32">13</Property>
    </Object>
    <Object Type="System.Management.Automation.PSVariable">
    <Property Name="Name" Type="System.String">strText</Property>
    <Property Name="Value" Type="System.String">World</Property>
    </Object>
    </Objects>And say I want to use the 'default' values if the xml file was not
    found, but if the xml file is found I want to use (replace) the
    variables and values defined in that xml file.

    First of all your sample code I not PowerShell.  Second XML has no "variables".  It is a structured document.  When imported into PowerShell it shows up as an XMLDocument object.  If you want values from the document you have
    to extract them by direct reference or query.
    The simple answer to your question is "yes".  You can assign a default to a variable which will be updated only if the value exist in the document.  The rest cannot be determined from what you have asked.
    Start by learning some of the basics of PowerShell scripting and ask a new question when you can see what it is you want to do.
    Here is a good starting point:
    http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
    The XML you have posted is actually PowerShell object serialization format so it is already a PS object.  It is not just arbitrary XML.  It isnot clear howyou acquired this which is another reason to learn more of the PS basics. 
    It appears that you have used ConvertTo-XML to create an XML object.  This can be sued to dave values and state but may not bethe best method.  Export-CliXml can persist an object and restore it more directly.  We can wrap this in a function
    that can be used to default values.
    Look into Export.CliXml and Import-CliXml.
    Example:
    $ziptable=@()
    $myProps=@{
    Name='Detroit'
    ZipCode='20192'
    $ziptable+=New-Object PsObject -Property $myProps
    $myProps=@{
    Name='New York'
    ZipCode='90100'
    $ziptable+=New-Object PsObject -Property $myProps
    $ziptable | Export-CliXml myzips.clixml
    $savezips = Import-CliXml myzips.clixml
    Result demo:
    PS C:\scripts> $savezips
    ZipCode Name
    20192 Detroit
    90100 New York
    PS C:\scripts> $savezips[0]
    ZipCode Name
    20192 Detroit
    PS C:\scripts> $savezips[0].Zipcode
    20192
    PS C:\scripts>
    Of course a simple lookup table would be done with a pure hash and persisted.  For more comples things I would use a custom dataset which can also be persited and restored the same way.  Sort of a poor man's portable database.
    ¯\_(ツ)_/¯

  • Reading variables from a shell script

    i was wondering if it is possible to enter variables from a shell script that an sql file can use:
    ex:
    shell script file
    #!/bin/ksh
    stty -echo
    read pwd?"Enter password for user: "
    echo
    stty echo
    read var?"Please enter value for variable: "
    echo
    $ORACLE_HOME/bin/sqlplus user/$pwd @TEST.sql
    sql file TEST.sql
    set serveroutput on
    set verify off
    spool out.log
    update table set parameter_value = '$var' where parameter_name = 'X';
    commit;
    exit;
    spool off;
    i tried that and it seems its updating my table with "var" and not what the user entered that is the bind variable $var
    am i missing something?

    if user hits enter (which means null) can the program
    not end and ask the user to enter another value?Try this way :
    while :
    do
            echo -n "Please enter value for variable: "
            read VAR
            if [ "$VAR" ]; then
                    break
            else
                    continue
            fi
    done

  • How do you use the windows User32.dll Library functions to read variables from other applications that are running

    I am trying to read a text box from a programme running at the same time as my Labview application using calls to the Windows
    User32.dll. I believe I need to find the window handle for the 'form' containing this text string and use this together with
    various other defined input variables to access the sting.
    I have no experience of using this 'Call Library Function Node', but have an understanding of the 'C' programming language. Does anyone have
    example Labview code showing how this might be done.
    Thanks

    If you're trying to access information that's being displayed in the window of another application and that application has no ActiveX interface, then yes, Windows calls can be used. There's a very good example on calling DLLs that ship with LabVIEW. Open the Example Finder (Help->Find Examples) and switch to the Search tab. Enter "Call" in the search box and open the VI "Call DLL". Run the VI, select any of the examples, and click the "Open Example VI..." button. That shows you how to call a DLL.
    Now, given that you have no experience in calling DLLs, have only an "understanding" of C (which to me means you have never written something like a DLL), and don't seem to know that much about what Windows functions you may need, you're going to find this route pretty difficult, especially since you have to deal with Windows API calls, which are not always that easy to do from LabVIEW.
    Let me propose an alternate solution. Go over to http://www.autoitscript.com/autoit3/ and download AutoIt. This is an automation tool that allows you to automate just about anything you want. It has an ActiveX interface that you can call from LabVIEW. I've attached an example VI that shows you how to use it to get the value of a text box from one of the tabs in the computer "System Properties" control panel applet.
    Attachments:
    AutoIt Example (v7).vi ‏25 KB

  • Reading variable from another class

    If you have two java classes both inside the same java package.
    And you declared a variable for example
    String bob;
    bob = "hello world?"How would you make it so that the other file could then output this value
    System.out.print(bob);Would you have to make the variable public and then something else?

    Are you working with a main and subclass then?
    Why not just write a String method and use it from the main class
    public String string()
    String bob = "Hello word"
    return bob;
    Then in your main class just create a object of the subclass
    Subclass obj = new Subclass();
    The just use System.out.println(obj.string());
    i guess this would work also....?

  • Read variable from other method

    i am coding a method which required a reading from a variable in another method.
    what's the syntax for getting the variable???
    I tried.....
    ++++++++++++++++++++++++++++++++++++++++++++++++++
    public static void main (String[ ]args)
    range_1
    private static double area (int radius, final double pi)
    radius = range_1
    return radius * radius * pi
    ++++++++++++++++++++++++++++++++++++++++++++++++++
    but it doesn't work

    "private static double area (int radius, final double pi)"
    final double pi? as the method parameter? ROFLHAHAHAHAHAHAHAHAHAHAHA
    That made my day.
    As for your question, make range_1 a global variable, in other words, declare it outside your main method
    Something like
    public class gary{
    int range_1;
    public static void main (String afgfg[]){
    range_1=//something;
    private static double area (int radius)
    radius = range_1
    return radius * radius * 3.14

  • Reading Variable from JSP and pass to servlet

    hello
    i have a servlet page which transfers data to a jsp page. The jsp displays the data only. Now i want to read a string from a jsp page and then pass it to the servlet.
    How can i do it?
    thnks

    hello
    this is working fine: out.println("<input
    type=\"hidden\" name=\"bookId\" value=\"+bookId+\"
    size=\"25\">") ;
    works fine
    thnksI guess you didn't understand me. Look to the difference between the following two statements:
    out.println("<input type=\"hidden\" name=\"bookId\" value=\"+bookId+\" size=\"25\">") ;and
    out.println("<input type=\"hidden\" name=\"bookId\" value=\""+bookId+"\" size=\"25\">") ;In the first you're handling the bookId variable as String, in the second it will use the actual value of bookId.

  • Reading variables from a text file into a flash projector exe

    I am using Flash CS4 and my script is in ActionScript2.
    I am developing a flash projector file that runs when a user puts in a cd to guide them through the steps they need to install a program and then kicks off the installer.
    I use fscommand to run a utility that reads the users registry to determine the PCs regional settings and then writes this to a text file in the users %temp% directory.
    I then use the LoadVariablesNum command to read in the text file and get the variables.
    This was working fine when I had the text file stored in a different directory, but when I try and refer to the %temp% directory, I get an Error opening file message.
    Is there anyway to get flash to look in the %Temp% directory?
    Thanks in advance,
    Carol Lutz

    Code-tags sometimes cause wonders, I replaced # with *, as the code tags interprets # as comment, which looks odd:
    ******...*.........To your code: Did you test it step by step, to find out about what is read? You could either use a debugger (e.g., if you have an IDE) or system outs to get a clue. First thing to check would be, if the maze size is read correctly. Further, the following loops look odd:for(int i = 0; i < maze.length; i++) {
        for(int x = 0; x < maze.length; x++) {
            if (input.hasNextLine()) {
                String insert = input.nextLine();
                maze[x] = insert.charAt(x);
    }Shouldn't the nextLine test and assignment be in the outer loop? And assignment be to each maze's inner array? Like so:for(int i = 0; i < maze.length; i++) {
        if (input.hasNextLine()) {
            String insert = input.nextLine();
            for(int x = 0; x < insert.size(); x++) {
                maze[i][x] = insert.charAt(x);
    }Otherwise, only one character per line is read and storing a character actually should fail.

  • Read variables from an XML file

    Hi all,
    I'm trying to query valuables in an xml document which is structured quite differently from the examples I've seen around here, and I can't get my head around what to do.
    The XML document I've got looks like this;
    <universalproperties>
    <property>
    <name>PropName1</name>
    <data>Data for prop1</data>
    </property>
    <name>PropName2</name>
    <data>Data for prop2</data>
    </property>
    <name>PropName3</name>
    <data>Data for prop3</data>
    </property>
    </universalproperties>
    What I need to do is query the XML document for the property name and then return the data associated with that property.  I've just got no idea how to do it.
    Any suggestions?
    Thanks!

    Is Universalproperties your root node?
    FWIW, this is the full code I played with. This builds the XML in situ, so if your actual XML is slightly different you may need to adjust the expression.
    $Name = 'PropName1'
    [xml]$XML = "<universalproperties>
    <property>
    <name>PropName1</name>
    <data>Data for prop1</data>
    </property>
    <property>
    <name>PropName2</name>
    <data>Data for prop2</data>
    </property>
    <property>
    <name>PropName3</name>
    <data>Data for prop3</data>
    </property>
    </universalproperties>"
    $Data = ($XML.SelectSingleNode("/universalproperties/property[name='$Name']/data")).'#text'
    $Data

  • Setting variables from a testcase?

    Hello,
    How do I access variables from my BPEL flow from a testcase?
    I need to set some header variables and such that is not availible in the emulate tab so I am looking for a way to manualy in my testcase add/alter/read variables from the BPEL flow?
    I know this "could" be emulated by setting them in the normal flow but since it is test specific I would like to avoid adding thing to the flow and instead have them in my "test case".
    // MickeM

    shouldn't I also be able to access the outer classes methods? It doesn't seem to do this either.

  • At end of tether!  Reading in variables from a text file

    Hi all
    My stress factor has gone through the roof because I am trying to read in from a text file (you may have seen some earlir questions about ArrayLists) it's just not working!
    The code is below. The result is that it's reading in all of the car data, none of the motorbike and only the first line for the services. It's odd and it's driving me insane!
    Here's an example of the data it's reading. There are about 7-10 sets of data per type
    <car><reg>AB04CDE</reg><make>Ford</make><model>Fiesta</model><colour>blue</colour><passenger_no>4</passenger_no></car>
    <service><service_no>13570</service_no><reg>J605PLE</reg><date>15:07:2006</date><miles>20000</miles><part_replaced>brake_pads</part_replaced><part_replaced>front_tyres</part_replaced></service>
    <motorbike><reg>TT05EKJ</reg><make>Triumph</make><model>Speedmaster</model><colour>black</colour><load>20.50</load></motorbike>
    Here's the code
    while (moreToRead) {
            String line;
            try {
              line = fileReader.getNextStructure();
    // collect the data from the file
              if (line.indexOf("<car>")> -1){
                // Select/Extract the registration element
                int nStart = line.indexOf("<reg>");
                int nEnd = line.indexOf("</reg>");
                String reg = line.substring(nStart+5,nEnd);
                // Select/Extract the make element
                nStart = line.indexOf("<make>");
                nEnd = line.indexOf("</make>");
                String make = line.substring(nStart+6,nEnd);
                // Select/Extract the model element
                nStart = line.indexOf("<model>");
                nEnd = line.indexOf("</model>");
                String model = line.substring(nStart+7,nEnd);
                // Select/Extract the colour element
                nStart = line.indexOf("<colour>");
                nEnd = line.indexOf("</colour>");
                String colour = line.substring(nStart+8,nEnd);
                // Select/Extract the passenger_no element
                nStart = line.indexOf("<passenger_no>");
                nEnd = line.indexOf("</passenger_no>");
                String passenger_no = line.substring(nStart+14,nEnd);
                //convert string to int
                int passengerInt = Integer.parseInt(passenger_no);
                // declare new object car and assign the variables then add it to the array.
                Car c = new Car (reg, make, model, colour, passengerInt);
                carList.add(c);
      } else if (line.indexOf("<bike>")> -1) {
             // Select/Extract the registration element
             int nStart = line.indexOf("<reg>");
             int nEnd = line.indexOf("</reg>");
             String reg = line.substring(nStart+5,nEnd);
             // Select/Extract the make element
             nStart = line.indexOf("<make>");
             nEnd = line.indexOf("</make>");
             String make = line.substring(nStart+6,nEnd);
             // Select/Extract the model element
             nStart = line.indexOf("<model>");
             nEnd = line.indexOf("</model>");
             String model = line.substring(nStart+7,nEnd);
             // Select/Extract the colour element
             nStart = line.indexOf("<colour>");
             nEnd = line.indexOf("</colour>");
             String colour = line.substring(nStart+8,nEnd);
             // Select/Extract the load element
             nStart = line.indexOf("<load>");
             nEnd = line.indexOf("</load>");
             String load = line.substring(nStart+6,nEnd);
             //convert load string to double
             double bikeLoad = Double.parseDouble(load);
             // declare new object motorbike and assign the variables then add it to the array.
             Motorbike m = new Motorbike (reg, make, model, colour, bikeLoad);
             bikeList.add(m);
      } else  {
        // Select/Extract the service_number element
        int nStart = line.indexOf("<service_no>");
        int nEnd = line.indexOf("</service_no>");
        String service_no = line.substring(nStart+12,nEnd);
        console.println("service = " + service_no);
        nStart = line.indexOf("<reg>");
        nEnd = line.indexOf("</reg>");
        String reg = line.substring(nStart+5,nEnd);
        console.println("service = " + reg);
        nStart = line.indexOf("<date>");
        nEnd = line.indexOf("</date>");
        String date = line.substring(nStart+6,nEnd);
        console.println("service = " + date);
        nStart = line.indexOf("<miles>");
        nEnd = line.indexOf("</miles>");
        String miles = line.substring(nStart+7,nEnd);
        console.println("service = " + miles);
        nStart = line.indexOf("<part_replaced>");
        nEnd = line.indexOf("</part_replaced>");
        String part_replaced = line.substring(nStart+15,nEnd);
        console.println("service = " + part_replaced);
        //convert string to int
        int dateOfService = Integer.parseInt(date);
        //convert string to double
        double milesAtService = Double.parseDouble(miles);
        //convert service no to unique int
        int serviceNo = Integer.parseInt(service_no);
        // declare new object service and assign the variables then add it to the array.
        Service s = new Service (reg, part_replaced, serviceNo, dateOfService, milesAtService);
          serviceList.add(s);
          catch (Exception e) {
            // Run out of data
            moreToRead = false;
    } If anyone can spy anything that could be causing this I love your advice. I simply can't see it.
    Jo

    hi jos,
    we have been asked not to use a parser for this assignment. evil
    tutor i think! lolYour example seems to imply that all the <tag> ... </tag> pairs have
    to occur on a single line; if that is so, you can do some cheap
    programming like this:String getText(String line, String tag) {
       int start= line.indexOf("<"+tag+">");
       int end= line.indexOf("</"+tag+">", start);
       if (start < 0 || end < 0) return null; // no <tag> ... </tag> pair found
       // return the text in between the <tag> ... </tag> tags
       return line.substring(start+tag.length()+2, end);
    }kind regards,
    Jos

  • I'm trying to connect a subVI with my VI, they both share common variables and the subVI is not reading one of the variables from the main VI...

    I can't figure out why the subVI will not read this one particular variable from the main VI. How can I figure out how to make sure these two VI's are communicating properly?

    Yes, please post example.
    We could probably give you an answer rather quickly if you did.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Is it possible to read Essbase Substitution variables from ODI?

    Is it possible to read Essbase Substitution variables from ODI?

    Hi,
    You can do it with custom code, if you have a read of a blog I wrote :- http://john-goodwin.blogspot.com/2009/11/odi-series-planning-11113-enhancements.html
    About half way through I go into reading essbase sub vars using the essbase java API.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Reading variables/​parameters from stpper motor controller

    I have three Pacific Scientific stepper motors and controllers. The controllers are programmable via a proprietary version of the basic programming language, called stepperbasic. I can control the motors using labview by performing a serial write function, and outputting an ASCII string to the controllers, for example 'GO.VEL', starts the motor moving. However i am unsure how i can read parameters from the controllers. For example there is a variable 'MOVING', this is logic 0 if the motor is not moving and 1 if the motor is moving. How can i get labview to read this variable and others like it?

    Thank for contacting National Instruments. From the sounds of your system, this post may be better aimed at our GPIB/Serial group rather than the Motion team. If the only communication you have with these controllers is through serial communication, then most likely you will need to use a serial read (or possibly the I/O Assistant if you are using LabVIEW 7.x) in order to pull in that information. I am not the expert here on serial, but for this you will need to know what commands to send to get this information out and then what type of data you are expecting.
    Another option that you can look into is if Pacific Scientific included a C/C++ library, then you may be able to call that dll or code from within LabVIEW to control the controllers/motors also. If you hav
    e not done so already, I would take a look at the documentation for your hardware and see what software came with it. If they provided anything that could be used to write a basic C/C++ program to control the motor, then you should be able to do the same from within LabVIEW.
    I hope this helps out some and let us know if you have any more specific questions.
    Regards,
    Michael
    Applications Engineer
    National Instruments

  • StringTokenizer to read in 4 variables from the command point

    Hi,
    I need to set up the Java StringTokenizer to read in 4 variables
    from a command prompt. It should be in the following format:
    X variable1 variable2 variable3where
    (is the command prompt)X (is either +, -, *, /, c, or e)
    variable1 variable2 and variable3 are integers.
    I would appreciate any answers that would help me find the way!
    Thanks in advance.

    Thank you for the code snippet, but the program does not function that way. Ie, it does not accept
    arguments when the program is first run, only after the program has excecuted.
    The program is to enter a simple command prompt, and await instructions in the form X int1 int2 int3
    where X can be c (convert the number int3 from number base int1 to number base int2), e (exit the
    program), +,-,/,* (add, subtract, divide or mutilply int2 to/by int3 in number base int1). Here is an example
    of the what the program execution should look like:
    c:\programming\java nbc
    > + 10 23 45 // Add 23+45 in base10
    68 // Write the answer on a new line and prompt
    - 16 5A 2C // Subtract 5A-2C in base 162E // Write the answer on a new line and prompt
    c 15 7 2E // Convert 2E in base 15 to base 762
    e // End of programc:\programming\
    My problem is, I do not know how to convert the first token to a variable that can be used to carry out one of
    the above mentioned procedures. For example, the first token taken from the command c 15 7 2E is "c".
    As I understand it, "c" is simply a string, and this cannot be used in logical procedures such as:
    int procedure = 0;
    if(operator == "c")
         procedure = 0;  //then use this variable
    }else
    if(operator == "e")
        System.exit(0): //quit the program
    Also, how can I set up a while loop to continuesly
    prompt the user for an instruction until "e" is entered?import java.io.*;
    import java.util.*;
    import java.util.StringTokenizer;
    public class blerk
         public static void main(String[] args) throws IOException
              InputStreamReader stdin = new InputStreamReader(System.in);
              BufferedReader br = new BufferedReader(stdin);
              boolean e = true;
              String str = "";
              String symbol = "";
              int value0 = 0;
              int value1 = 0;
              int value2 = 0;
              System.out.print(">");
              str = br.readLine();
              StringTokenizer st = new StringTokenizer(str, " ");
              int i = 0;
              int option = 0;
              while (st.hasMoreTokens())
                   switch(i)
                        case 0:
                             symbol = st.nextToken();
                             // This part is obviously not correct. How can this be implemented to select and store the operating procedure the user enters?
                             if(symbol = "e")
                                  System.exit(0);
                             }else
                             if(symbol = "c")
                             }else
                             if(symbol = "+")
                                  option =
                        break;
                        case 1:
                             value0 = Integer.parseInt(st.nextToken());
                        break;
                        case 2:
                             value1 = Integer.parseInt(st.nextToken());
                        break;
                        case 3:
                             value2 = Integer.parseInt(st.nextToken());
                        break;
                        default:
                             System.out.println("format: >operator x y z");
                        break;
                   i++;
              System.out.println(symbol + value0 + value1 + value2); //test
    Any advice would be most appreciated.
    Benjamin.

Maybe you are looking for

  • Promoted link to trigger the content display in a web part

    Here is what I am trying to achieve. To have a promoted link (to a html source) at the site home page. On clicking the link, the content displays either in a pane just below the link or in a web part. Is this possible OOB? if not, how can this be ach

  • Return & shift keys not working

    My keyboard is unresponsive.  problms started w/ "L" and "9" and "Enter/Return" keys.  Did a s/w update and reboot but still no success.  Now only "Shift" and "Enter/Return" keys are unresponsive.

  • End of clip black 'thing'

    See this image: If you look caefully then you see a thin black part at the end of the middle clip How do I get rid of it!! This is causing me problems (I think) I have one clip that plays for 10 seconds This clip gets shrunk to 20% and plays on a loo

  • Is tech support kept in the dark?

    I have had occasion to contact tech support several times in the last few months because my broadband connection kept dropping out. Invariably there is a line test and I am told there is no fault and it must be something in my wiring or setup. On one

  • Problems in setting user attributes using amclientsdk

    Hi, I am trying to set user attributes using amclientsdk. I am using the below mentioned piece of code for the same: AMIdentity idn = new AMIdentity(auth1.getSSOToken()); Set s = new HashSet(); s.add("cn=adviser,dc=axa,dc=au"); Map roleMap = new Hash