LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get a range of strings from a table using GetTableCellRangeVals?

I use GetTableCellRangeVals to get blocks of numbers from my tables all the time, but I don't understand how to declare an array of strings to get a block of strings from a column of a table.
 
My table includes a single column of strings limited to no more than 24 characters wide, and there are 16 rows.
 
I tried declaring a variable like the following:
 
char myStringList[16][24];
 
And then tried calling GetTableCellRangeVals to grab the strings entered in the table and put them into myStringList.  But GetTableCellRangeVals won't use myStringList because myStringList is a 'pointer to an array[24] of char' but GetTableCellRangeVals wants a 'pointer to a pointer to a char'.
 
I tried looking through the example software but couldn't find anything.  I found a work-around by looping 16 times and calling GetTableCellVal, but I'd prefer to know how to do it right.
 
Thanks for the help!
 
Brian
0 Kudos
Message 1 of 3
(3,232 Views)
Brian,

You need to pass an array of strings to the function. Something like this:

char *myStringList[16];


The GetTableCellRangeVals function will allocate each of the 16 individual buffers (since normally, you can't be expected to know the maximum size of each string). When you're done using the strings, you need to pass myStringList to the function FreeTableValueStrings so that they can be freed.

Luis
0 Kudos
Message 2 of 3
(3,228 Views)

Louis,

 

Greatly appreciated!

Brian 

0 Kudos
Message 3 of 3
(3,214 Views)