"Using a CIN to Create an Array of Strings in LabVIEW" example crashes LV on Linux

Tried to utilize this NI example: "Using a CIN to Create an Array of Strings in LabVIEW" (http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B4B282BE7EF907C8E034080020E74861&p_node=&p_source=External)
Compiles OK with the makefile made by the LV's lvmkmf utility. Nevertheless when I try to run the VI (with the code loaded into the CIN, of course), LabVIEW 7.1.1 on a SUSE 9.3 Linux machine crashes:
LabVIEW caught fatal signal
7.1.1 - Received SIGSEGV
Reason: address not mapped to object
Attempt to reference address: 0x0
Segmentation fault
Any ideas? Did anybody try this on a Windows machine?

H View Labs wrote:
Tried to utilize this NI example: "Using a CIN to Create an Array of Strings in LabVIEW" (http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B4B282BE7EF907C8E034080020E74861&p_node=&p_source=External)
Compiles OK with the makefile made by the LV's lvmkmf utility. Nevertheless when I try to run the VI (with the code loaded into the CIN, of course), LabVIEW 7.1.1 on a SUSE 9.3 Linux machine crashes:
LabVIEW caught fatal signal
7.1.1 - Received SIGSEGV
Reason: address not mapped to object
Attempt to reference address: 0x0
Segmentation fault
Any ideas? Did anybody try this on a Windows machine?
This code is badly broken. In addition to resizing the actual handle to hold the number of string handles you also would need to create the string handles itself before attempting to write into them. NumericArrayResize is the fucntion to use as it will either resize an existing handle (if any) or create a new one if the value is uninitialized (NULL).
/* resize strarr to hold handles to NUMSTRINGS strings */
err = SetCINArraySize((UHandle)strarr, 0, NUMSTRINGS);
if (err)
goto out;
/* perform this loop once for each element */
/* of array of strings being created */
for (i = 0; i < NUMSTRINGS;) {
LStrHandle handle = (*strarr)->arg1[i];
/* determine length of string that will be element of strarr */
strsize = StrLen(str[i]);
err = NumericArrayResize(uB, 1, &handle, strsize);
if (err)
goto out;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/* moves strsize bytes from the address pointed to */
/* by str[i] to the address pointed to by the data pointer in the handle */
MoveBlock(str[i], LStrBuf(*handle), strsize);
/* manually set size of string pointed to by *strarr */
(*((*strarr)->arg1[i]))->cnt = strsize;
/* manually set dimSize of strarr */
(*strarr)->dimSize = ++i;
return noErr;
out:
return err;
Rolf KalbermatterMessage Edited by rolfk on 06-30-2005 03:15 AM
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions

Similar Messages

  • Creating an Array of Strings

    Does anyone know how to create an array of three strings? I need to then prompt a user for the three strings and enter them into the array...No idea how to code this at all.

    i'm not quite sure about your problem,anyway i've posted a snippet hope this helps,if not explain in detail.. :)
    import java.io.*;
    class ts{
         public static void main(String as[]) throws Exception{
              int j=3;//no of strings to be inputted i.e 3 in ur case
              String sArray[]=new String[j];
              for(int i=0;i<j;i++){
              BufferedReader reader = new BufferedReader
             (new InputStreamReader(System.in));
              System.out.println("Enter name"+(i+1));
              sArray[i] = reader.readLine();
              for(int i=0;i<j;i++){
                   System.out.println("array name"+(i+1)+" = "+sArray);

  • Array of strings in container won't pass to array of strings in LabVIEW cluster

    I'm new to TestStand but am a CLD.  I've taken a 3-day custom course that covered most of TestStand Core 1 and some of Core 2.  I'm using TestStand 2013 and LabVIEW 2013.
    I have a VI that needs an input of a cluster containing, in this order:
    1D array of strings named Column_Labels
    2D array of doubles named Results_Data
    1D array of paths named Graphics_File_Paths
    1D array of booleans named Pass_Fail
    In TestStand I created a custom data type called Maxim_Results from the VI module tab in the sequence.  When I reference a local (MINSYS_Reuslts) that is made from this Type I get the following error:
    No corresponding subproperty in argument 'Locals.MINSYS_Results' of type 'Maxim_Results' for cluster element 'Maxim_Results.Column_Labels'
    If, however, I reference each container element to each cluster element separatley there is no error:
    Can anyone help me understand why this is happening?
    Kelly Bersch
    Certified LabVIEW Developer
    Kudos are always welcome
    Solved!
    Go to Solution.

    Hey Kelly,
    I just set up the situation you described, and it worked properly for me. However, I did notice that in your example where you referenced each element individually, your Column_Labels element is actually called "Column_Lables". If this was also misspelled in the LabVIEW Cluster Passing setting for the custom type, it would cause the behavior you're seeing. Could this possibly be the case?
    Daniel E.
    TestStand Product Support Engineer
    National Instruments

  • How to use NewObjectArray method to create an array?

    This is my code:
    #include <jni.h>
    JNIEXPORT void JNICALL test(JNIEnv *env,jclass jcls)
         jobjectArray array=(env)->NewObjectArray(10,jcls,NULL);
    }I use g++ compiler got this error:
    test.cpp: In function `void test(JNIEnv, __jclass*)':*
    test.cpp:5: invalid conversion from `__jarray' to `__jobjectArray*'*
    Why?

    I don't know why you're getting this error (VC++ and gcc are both fine for me with the Java 1.6 includes), but I do notice that some of the Sun documentation explicitly casts the result of NewObjectArray:
    ret= (jobjectArray)env->NewObjectArray(5,
    env->FindClass("java/lang/String"),
    env->NewStringUTF(""));
    From: http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jnistring.html
    Does your function work correctly after a class cast? Which JVM version are you using?

  • How do I resize an array of strings in a CIN ?

    I've been using a call to NumericArrayResize() to allocate enough memory for numeric arrays, but I now have an array of strings that I need to build in a DLL/CIN and pass back to Labview. Can someone point me to a snippet that will demonstrate how to populate an array of strings with data?
    Kindest,
    Warren

    Check the follwing example. It may be what you want:
    Using a CIN to Create an Array of Strings in LabVIEW
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&AD517F5DCCAF70228625683A000A570F&cat=2F4F574886553A62862567AC004F032D
    Also, check the following example, as it provide an example on how to handle strings.
    Code Interface Node (CIN) That Converts a LabVIEW String to a C String, Modifies it, and Returns it as a LabVIEW String
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&D978409908EA760D8625683A000B6B6E&cat=2F4F574886553A62862567AC004F032D
    Regards;
    EV
    www.vartortech.com

  • How can I create a custom data type that is a 2D array of string by using TestStand API?

    Hi all,
    I'm new in TestStand:
    I'm able to create a custom data type that is a 1D array of string but I cannot find the way to create a 2D array of string.
    Can anyone help me?
    Thank you in advance.
    Federico

    I made it!!
    Indeed my 2D array is an item of a container:
    /*  Create a new container */
    RunState.Engine.NewPropertyObject(Locals.NewDataType,PropValType_Container,False,"",0)
    /*  Create an array of strings as item of the container */
    Locals.NewDataType.NewSubProperty("Array_2D",PropValType_String,True,"",0)
    /*  Reshape the array as an empty 2D array */
    Locals.NewDataType.GetPropertyObject("Array_2D",0).Type.ArrayDimensions.SetBoundsByStrings("[0][0]","[][]")
    being:
    NewDataType a local property (type Object)
    Attachments:
    AddCustomTypeAndCreateFileGlobals.seq ‏11 KB

  • Help creating 2D array from tab delimited text file

    I can print the info from the file, but darned if I can't make a 2-D array.
    import java.util.regex.*;
    import java.io.*;
    public final class goodSplitter {
        private static BufferedReader br;
        private static BufferedReader br2;
        private static String INPUT;
        private static int numLines;
        private static int numLine2;
        private static int q;
        private static int t;
        private static int n;
        private static String [][] indexArray;
        public static void main(String[] argv) {
            initResources();
            processTest();
            closeResources();
        private static void initResources() {
           try {
                  br = new BufferedReader(new FileReader("index.txt"));
              System.out.println("found the input file.");
                } catch (FileNotFoundException fnfe)
                   System.out.println("Cannot locate input file! "+fnfe.getMessage());
                          System.exit(0);
           try {
                  br2 = new BufferedReader(new FileReader("index.txt"));
              System.out.println("found file again.");
                } catch (FileNotFoundException fnfe)
                   System.out.println("Cannot locate input file again! "+fnfe.getMessage());
                          System.exit(0);
         try {     
                   int numLines = 0;     
                   while ( ( INPUT = br.readLine( ) ) != null )
                        { numLines++; } // end while
                   System.out.println("file has the number of lines: " + numLines);
                   q = numLines;
                   System.out.println("creating the array.");
                   String [][] indexArray = new String[q][];
                   System.out.println("populating the array.");
                   while ( ( INPUT = br2.readLine( ) ) != null ) {
                        n = t++;
                        System.out.println("first array index = " + n);
                        String[] ss = INPUT.split("\\s");
                        for(int i = 0; i < ss.length; i ++)
                                  System.out.println( new String( ss[i] ) );
                                  indexArray[n] = ss[i];
                             } // end for
                        } // end while
         } catch (Exception e)
              {System.out.println("something went wrong in populating the array of length " + q); }}
    private static void processTest() { System.out.println("processed text."); }
    private static void closeResources() {
    try{ br.close();  }catch(IOException ioe){} }

    you haven't sized the 2nd part of the 2d array
    add this line
    String[] ss = INPUT.split("\\s");
    indexArray[n] = new String[ss.length];//<--------------
    for(int i = 0; i < ss.length; i ++)
    but note you have declared indexArray both as a class variable
    private static String [][] indexArray;
    and a variable local to the try/catch block
    String [][] indexArray = new String[q][];
    probably what you want is
    indexArray = new String[q][];

  • Not using an array of strings

    how do I write a java method without using an array of strings?
    for example:
    import java.io.File;
    public class rename
    public static void main(String[] args)
    File src = new File(args[0]);
    File dst = new File("c:\\temp\\temp.txt");
    boolean wasRenamed = src.renameTo(dst);
    I don't want to have main use an array of strings but I want rename to work as a class

    This is what I changed it to and am getting an -- Exception in thread "main" java.lang.NoSuchMethodError: main
    Sorry this is my first java program
    import java.io.File;
    class App {
         private App() {
              super();
         static final public void main(final String[] args) {
              switch (args.length) {
                   case 1:
                        try {
                             Rename rename = new Rename();
                             rename.rename("c:\\felss\\charles.txt.bak"); // see, it's kind of silly to have same names for class and method
                             System.exit(0);
                        catch (Throwable e) {
                             e.printStackTrace();
                             System.exit(1);
                        break;
                   default:
                        System.err.println("Usage: java App [new name]");
                        System.exit(1);
    public class Rename {
         public Rename() {
              super();
         final public void rename(final String newName) {
              File src = new File(newName);
              File dst = new File("c:\\felss\\charles.txt");
              boolean done = src.renameTo(dst);
    }

  • How do I pass an array of strings? (Help Me... Please!!! .Read Me....)

    Dear All.
    Help Me...
    English is not very good. Google translator is used.
     How do I pass an array of strings?
    Please refer to the VB program
     ===========================================
    Private Sub m_btn_Click()
        Dim nReturn As Long
        Dim sPpid As String
        Dim sMdln As String
        Dim sSoftRev As String
        Dim nCount As Long
        Dim saCCodes(2) As String
        Dim naPCount(2) As Long
        Dim saPNames(10) As String
        sPpid = "PPID001"
        sMdln = "Mdln"
        sSoftRev = "Rev001"
        nCount = 2
        saCCodes(0) = "1"
        naPCount(0) = 5
        saPNames(0) = "Param001"
        saPNames(1) = "Param002"
        saPNames(2) = "Param003"
        saPNames(3) = "Param004"
        saPNames(4) = "Param005"
        saCCodes(1) = "2"
        naPCount(1) = 5
        saPNames(5) = "Param006"
        saPNames(6) = "Param007"
        saPNames(7) = "Param008"
        saPNames(8) = "Param009"
        saPNames(9) = "Param010"
        nReturn = m_XGem.GEMReqSend(sPpid, sMdln, sSoftRev, nCount, saCCodes(0), naPCount(0), saPNames(0))
        If (nReturn = 0) Then
            Call Me.AddMessage("[EQ ==> XGEM] GEMReqSend successfully")
        Else
            Call Me.AddMessage("[EQ ==> XGEM] Fail to GEMReqSend (" & nReturn & ")")
        End If
    End Sub
    =================================================
    nCount, naPCount enough saCCodes, saPNames value must be sent.
    How to handle an array of strings in LabView is impatient.
    I want to VB program implemented in LabView.

    Have you actually tried to right click on the according node parameter and select Create->Constant or Create-Control??
    And I don't see any string array in the parameter list. That are all simple strings and the VB code in your first post clearly shows that the call to the function only indexes the first element of those arrays to be passed to the function, not the entire array.
    If the function really reads arrays despite being declared as only taking strings then it is using some weirdo VB trickery and there will be no way to replicate that in LabVIEW.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Array of String for input paramter + dynamic invocation

    Does anybody know a place I can find an example of web service
    using the following methods:
    1. Array of String as input parameter
    2. Client uses dynamic invocation
    Specifically, 1. how do I define the parameter type in web-services.xml?
    2. how do I refer to the type in a client code?
    Thanks,
    Hong

    Hello,
    The doclitparam interop round 3 example does a echo string array.
    http://dev2dev.bea.com/managed_content/direct/webservice/r3server.zip
    Also there is a DII example in the WebService Wizard's archive:
    http://dev2dev.bea.com/managed_content/direct/webservice/wswa.html#qz29
    HTH,
    Bruce
    Hong wrote:
    Does anybody know a place I can find an example of web service
    using the following methods:
    1. Array of String as input parameter
    2. Client uses dynamic invocation
    Specifically, 1. how do I define the parameter type in web-services.xml?
    2. how do I refer to the type in a client code?
    Thanks,
    Hong

  • How do you create an array without using a shell on the FP?

    I want to be able to read the status of front panel controls (value, control box selection, etc.) and save it to a file, as a "configuration" file -- then be able to load it and have all the controls set to the same states as were saved in the file. I was thinking an array would be a way to do this, as I have done that in VB. (Saving it as a text file, then reading lines back into the array when the file is read and point the control(s) values/states to the corresponding array element.
    So how do I create an array of X dimensions without using a shell on the front panel? Or can someone suggest a better way to accomplish what I am after? (Datalogging doesn't allow for saving the status by a filename, so I
    do not want to go that route.)

    Thanks so much m3nth! This definitely looks like what I was wanting... just not really knowing how to get there.
    I'm not sure I follow all the icons. Is that an array (top left with 0 constant) in the top example? And if so, that gets back to part of my original question of how to create an array without using a shell on the FP. Do I follow your diagram correctly?
    If I seem a tad green... well I am.
    I hope you understand the LabVIEW environment and icons are still very new to me.
    Also, I had a response from an NI app. engineer about this problem. He sent me a couple of VI's that he threw together approaching this by using Keys. (I still think you are pointing to the best solution.) I assume he wouldn't mind m
    e posting his reply and the VI's for the sake of a good, thorough, Roundtable discussion. So here are his comments with VI's attached:
    "I was implementing this exact functionality this morning for an application I'm working on. I only have five controls I want to save, but they are all of different data types. I simply wrote a key for each control, and read back that key on initialization. I simply passed in property node values to the save VI at the end, and passed the values out to property nodes at
    the beginning. I've attached my initialize and save VI's for you to view. If you have so many controls that this would not be feasible, you may want to look into clustering the controls and saving the cluster as a datalog file.
    Attachments:
    Initialize_Settings.vi ‏55 KB
    Save_Settings.vi ‏52 KB

  • How to create an array using reflection.

    How to create an array using reflection.
    I want to achive something like this,Object o;
    o = (Object)(new TestClass[10]);but by use of reflection.
    To create a single object is simple:Object o;
    o = Class.forName("TestClass").newInstance();But how do I create an array of objects, when the class of objects is known only by name? (Can't use Object[] because even though an Object[] array can be filled with "TestClass" elements only, it Cannot be casted to a TestClass[] array)
    Anybody knows?":-)
    Ragnvald Barth
    Software enigneer

    Found it!
    the java.lang.reflect.Array class solves it!
    Yes !!!

  • What is the best way to create diagonal array in order to avoid MEMORY IS FULL error created by using INITIALIZE ARRAY vi?

    Using the values in a 1D array, I need to place them along the diagonal of a 2D array. Currently, I've been using INITIALIZE ARRAY VI to create 2D array of zeroes and then usE REPLACE ARRAY SUBSET to put the 1D array values on the diagonal. This works sometimes but I often get an error stating that the memory is full and that the application was stopped at INITIALIZE ARRAY.
    I'd appreciate any advice on how to stop this from occuring.
    Thanks and happy holidays,
    Hunter (LabView 6.1 user)

    Weather is the same here, too.
    Sorry about the PDF. I had forgotten about the PRTSCN option. See the attached JPG.
    I'd send you an example input that is giving me problems but today, my computer seems to be behaving and the error hasn't popped up. This makes me believe that it's truly a memory problem with my machine.
    This VI is a subVI used in several computationally intensive applications.
    If you're still interested in playing with it, I will email it to you. Please send me your address. In fact, I see you're in the oil & gas industry and I'd like to hear what you're working on since I work in that industry as well.
    Thanks again, Hunter ([email protected])
    Attachments:
    VI_Diagram.jpg ‏104 KB

  • Using JLabel[] to create an array of image labels

    Hello, I am quite new to Java so I am not sure if the following is even the best way to do what i am trying to do ... but please advise:
    I am making a JLayeredPane mapArea with grid lines where the user will be able to change the scale of the map and the grid lines can move along. The way I approached it is to create JLabel arrays that contains every single gird line i am going to use, add them to the map panel at the bottom-most layer and position them according to the scale. Below is the code that I wrote:
    int i = 0;     //local index variable for the for loops below
    JLabel[] vlineArray = new JLabel[50];
    JLabel[] hlineArray = new JLabel[50];
    ImageIcon[] vlineImageArray = new ImageIcon[50];
    ImageIcon[] hlineImageArray = new ImageIcon[50];
    for( i=0; i<50; i++ ){
         vlineImageArray[ i ] = new ImageIcon(GUI.class.getResource("vline.gif")); 
         hlineImageArray[ i ] = new ImageIcon(GUI.class.getResource("hline.gif")); 
    // vertical line array
         for( i=0; i<50; i++){
         vlineArray [ i ] = new JLabel(vlineImageArray[ i ]);
    mapArea.add(vlineArray[ i ],1);
    // horizontal line array
    for( i=0; i<50; i++){
         hlineArray [ i ]= new JLabel(hlineImageArray[ i ]);
         mapArea.add(hlineArray [ i ],1);
    }}I tried to position these Jlabels in the array using setBounds:
    i.e. vlineArray.setBounds(......)
    But nothing showed... But if I simple create a vline by itself and add it to the map pane and setBounds. The vline shows up fine:
    // this works
    JLabel vlineImage = new JLabel(vline);
    mapArea.add(vlineImage);
    vlineImage.setBounds(.....);I also tried to post at the java programming forum
    http://forum.java.sun.com/thread.jspa?threadID=646495&tstart=15
    But nothing worked.
    Please help! Thanks a bunch!

    if I were going to draw grid lines over a map area, I would put a component the size of the layered pane in the layered pane which is transparent and can be given a scale and can override the paint method to paint the lines directly instead of trying to handle lots of labels like you're doing.

  • How to create an array list of strings by using buttons?

    HI, i need some guidance from you guys to help me out. How do i create a list of array whenever i click on a button it will generate a string and place it in an array row by row. if i dont click on the button it will ignore it and wont create the array. i have tried many technics such as looping and building array but it wont generate the list that i want.
    Attachments:
    untitled.JPG ‏97 KB

    I am not sure if I have understood your question correctly, but is the attached what you were looking for?
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies
    Attachments:
    Example.vi ‏12 KB
    example.JPG ‏100 KB

Maybe you are looking for

  • Bypass Header and Footer in Excel output

    I have a Requirement like this I need to have the report output in the below three formats PDF,EXCEL,HTML But when we see the ouput in EXcel it should not have the Footer and Header Scetion , remaining two output formats (PDF,HTML) must have the Foot

  • Jdbc database access

    The following is not running and it got compiled . I want to know whether it is possible to open a recordset for processing based on a value from another recordset . I need to get values from a recordset based on a value from previous recordset.. Nes

  • Template Installer JDI NW2004s SP05

    HI all, I have installed NW2004s and updated to SP05 and try to run the template installer for usage type DI. However when I run the template installer with template "DI_Postinstallation", I got an error seems related to localization problem on step

  • TS3899 The mail server "mobile.charter.mail" is not responding.

    I can send mail, but cannot receive mail. I have been to Charter and AT&T, and neither can help. Have not accessed mail since 3/4/2014 from my iphone 5. I have deleted and added several times. Does not help. My son can access mail from his iPhone and

  • Set Document Actions

    Hi, I simply want to notify a user that a required field is blank when they print or save the PDF. Based on other posts in the forum, I added the following JavaScript in Set Document Actions > Document Will Save and Document Will Print. function chec