Pass String Array to DLL
Hi,
I m trying to pass a String Array to a DLL, but I can't found the type for the "Char *heihei[ ]"
Here I attached the screenshot here. Hopefully some expert here can help me to solve out this thing. Thanks a lot in advance.
DLL input:
int __stdcall RunDLLUI (char * pszMainPath, char * pszFileName, int * nArrayErrorRow, char * pszArrayErrorCol[], int nNumOfErrors, int nOffsetError);
Please refer to the pictures attached. Thanks again for your time.
Attachments:
code.JPG 29 KB
front.JPG 40 KB
DataType.JPG 49 KB
You should post your LabVIEW question to the LabVIEW board.
Similar Messages
-
Example of passing String Array from java to C using JNI
hi all
i searched net for passing string array from java to C but i dont get anything relevent
i have
class stu
int rollno
string name
String [] sub
i want to pass all as String array from java to C and access it C side1. Code it as though it were being passed to another method written in java.
2. Redefine the method implementation to say "native".
3. Run jnih to generate a C ".h" file. You will see that the string array
is passed into C as a jobject, which can be cast to a JNI array.
4. Write the C code to implement the method and meet the interface
in the generated .h file. -
How can i pass string from C++ DLL to Java via JNI?
Hi everybody. I made a DLL with Borland C++. I must pass a string from this dll to Java via JNI.Namely i define a string variable in C++ DLL and i send this variable's value to Java via JNI.
I can pass integers but i couldnt Strings. . How can i do this? is there any sample?Hi,
So your function should be private static native String get_text();
(It's often a good idea to make native methods private since when you change signatures you generally have to change java wrapper methods only).
I know nothing about C++ strings but I'm pretty sure that you can convert it to char*, so
do :
char* szMyString = myString.toChar*();
Then return from native with JNU_NewStringPlatform(env, szMyString)
(see my 1st answer for JNU_NewStringPlatform() description).
--Marc (http://jnative.sf.net) -
How to Pass String array from Java to PL/SQL and this use in CURSOR
hi,
I cant understand how to pass Array String as Input Parameter to the Procedure and this array use in Cursor for where condition like where SYMPTOM in( ** Array String **).
This array containing like (SYMPTOM ) to be returned from the java to the
pl/sql (I am not querying the database to retrieve the information).
I cannot find an example on this. I will give the PL/SQL block
create or replace procedure DISEASE_DTL<*** String Array ***> as
v_SYMPTOM number(5);
CURSOR C1 is
select distinct a.DISEASE_NAME from SYMPTOM_DISEASE_RD a
where ltrim(rtrim(a.SYMPTOM)) in ('Fever','COUGH','Headache','Rash') ------- ***** Here use this array element(like n1,n2,n3,n4,n5..) ******
group by a.DISEASE_NAME having count(a.DISEASE_NAME) > 3 ----------- ***** 3 is no of array element - 1 (i.e( n - 1))*****
order by a.DISEASE_NAME ;
begin
for C1rec IN C1 loop
select count(distinct(A.SYMPTOM)) into v_SYMPTOM from SYMPTOM_DISEASE_RD a where A.DISEASE_NAME = C1rec.DISEASE_NAME;
insert into TEMP_DISEASE_DTLS_SYMPTOM_RD
values (SL_ID_SEQ.nextval,
C1rec.DISEASE_NAME,
(4/v_SYMPTOM), --------**** 4 is no of array element (n)************
(1-(4/v_SYMPTOM)));
end loop;
commit;
end DISEASE_DTL;
Please give the proper solution and step ..
Thanking you,
AsishI've haven't properly read through your code but here's an artificial example based on a sql collection of object types - you don't need that, you just need a type table of varchar2 rather than a type table of oracle object type:
http://orastory.wordpress.com/2007/05/01/upscaling-your-jdbc-app/ -
Pass String Array to Another JSP
Hi,
I want to pass a string array to a nother JSP. Could any one pls tell me whether this is possible in JSP,then how. If it's impossible how can i full fill my task.
Thanks,
Dumindu.Depends on how you are navigating from one jsp to the other.
For ex: if you are using a forward
in jsp1
sthinglike
String[] strArray = new String[]{"val1","val2","val3"};
request.setAttribute("arrayatt",strArray);in jsp it can be retrieved as
String[] ret = (String[])(request.getAttribute("arrayatt"));
Hope that helps -
NO access to certain cells when passing 2D array to DLL
I am trying to feed a 2D array (image reading) to a DLL, but it always gives a 1097 error. I debugged the original C++ code. It narrows down to the point that some pixels cannot be read. So I write a simple C code to reproduce the issue.
As you can see from the following screenshot, this C code simply returns the number indexed by 'index'. When fed from Labview to the DLL, I chose to feed a 2D array as 'Array Data Pointer'. Then I put it in a for loop to read through the entire array. The returned array showed that the cells after 75th row cannot be read with a 1097 error. But why? What did I do wrong?Yes, initialize-array initializes a table of I32, and the type in the CLF matches, but the DLL is still indexing into (what it thinks is) an array of Double - see the function syntax the C source-code: "(double *x",...).
If you simply change the initialize-array type to U64, it will allocate enough space. It's not even necessary to correct for type conversion - you're still passing a pointer, the DLL will be happy. -
Problem when passing string array in sessions showing null value
i am trying to pass a string array but it is showing me the null value
i think the the problem is seem to be in session.settAttribute("subject['"+i+"']",subject) in 2.login_action.jsp
or in String sub1=(String) session.getAttribute("subject[0]"); in 3.user_home.jsp
i have following three pages
1.login.html
2.login_action.jsp
3.user_home.html
1.login.html
<html>
<body>
<form method="post" action="login_action.jsp">
Username<input type="text" name="username"></input>
<br>
Password<input type="password" name="password"></input>
<input type="submit" value="login"></input>
</form>
</body>
</html>
2.login_action.jsp
<%@ page contentType="text/html"%>
<%@ page import="java.sql.*" %>
<%!
String user,pwd;
String subject[]=new String[10];
int i,totalsubject;
%>
<%
try
user=request.getParameter("username");
pwd=request.getParameter("password");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:ods","scott","tiger");
PreparedStatement ps = con.prepareStatement("select password from users where username='"+user+"'");
ResultSet rs = ps.executeQuery();
if(rs.next())
if(rs.getString("password").equals(pwd))
session.setAttribute("username",user);
PreparedStatement ps2 = con.prepareStatement("select subject_id from allot_teachers where staff_id='"+user+"'");
ResultSet rs2 = ps2.executeQuery();
while(rs2.next())
i=0;
subject[i]=rs2.getString(1);
// if i display here the subjects in out.println(subject[i]) it is working fine
// but in next redirected page it is showing null
session.setAttribute("subject['"+i+"']",subject[i]);
//out.println(subject[i]);
i++;
response.sendRedirect("user_home.jsp");
else
out.println("error invalid username or password");
else
out.println("error invalid username or password");
con.close();
catch(Exception e)
out.println(e);
%>
3. user_home.jsp
<%@ page contentType="text/html"%>
<%@ page import="java.sql.*" %>
<html>
<%
String user,pwd,cat,cat1;
String username=(String) session.getAttribute("username");
if(username==null)
response.sendRedirect("login.html");
//just tried for first two subjects
String sub1=(String) session.getAttribute("subject[0]");
String sub2=(String) session.getAttribute("subject[1]");
//here it is printing null
out.println(sub1);
//here it is printing null
out.println(sub2);
%>
<form method="post" action="logout.jsp">
<input type="submit" value="Logout"></input>
</form>
</html>
Cheers & Regards
sweetyThe name in getAttributre doesnt match the name in setAttribute.
Note "subject[0]" is a string containing 10 chars, "subject" is a string containing 7 chars.
Here is your code:
session.setAttribute("subject",subject);
String sub1=(String) session.getAttribute("subject[0]"); -
Pass string array to Oracle function from Web page
Hi. I need to pass a two-dimensional array of string values to an Oracle function from an ASP.NET page. Is there an efficient way to accomplish this? I'm thinking I'll have to create a long string with special delimiters,
|12345^4.000|67890^3.670|.....
I'd parse the string on Oracle and break it into its component parts. In this example, each "record" is separated by the bar "|" and each field is separated by the up arrow "^". So each record has two fields.
Is this a good approach? Your input is much appreciated. Thanks.In PL/SQL, it is easy enough to define a record type with two attributes and declare a store procedure that takes in an array of those parameters. I know that from Java it is possible to create and pass in such an array. I would suspect that the same is possible from .Net but I am not a competent .Net developer.
Justin -
Passing String Array from Java to PL/SQL
Hi,
We are having couple of packages which have been written in PL/SQL . I would like to know how i can send arrays as input parameters from Java to any stored proc in Oracle. I am having Oracle 8i as the DB and am using Websphere RSA for deployment purposes.
please find below Java , PL/SQL code and exception
PL/SQL Code :
PACKAGE PKG_SURCHARGE
IS
TYPE commodity_key IS TABLE OF VARCHAR2(500) INDEX BY BINARY_INTEGER;
PROCEDURE RETRIEVE_CHARGES
in_Commodity_tab IN commodity_key,
IS
BEGIN
dbms_output.put_line('in_Commodity_tab(' || '0' || ') : ' || in_Commodity_tab(0) );
Java Code :
CallableStatement cstmt=null;
Connection conn=null;
try{
conn=getConnection();
System.out.println("++++++connected");
String sqlStr = "{call Pkg_Surcharge.RETRIEVE_CHARGES(?) }";
cstmt = conn.prepareCall(sqlStr );
//1.
String[] javaArray={"20081117","20081117"};
ArrayDescriptor dateDescripter = ArrayDescriptor.createDescriptor( "commodity_key", conn );
oracle.sql.ARRAY dateArray = new oracle.sql.ARRAY(dateDescripter, conn, javaArray);
System.out.println("++++++registered-1");
Catch (Exception e){
e.printStackTrace();
Exception Occured:
java.sql.SQLException: Invalid Pattern Name <Schema Name>.commodity_key
Appreciate your help in this regard
Thanks
Srini
Edited by: [email protected] on Nov 25, 2008 4:55 AMAvi is correct. You must create a varray or nested table instead of using a PL/SQL index-by table.
SQL> create type commodity_key as varray(#) of varchar2(500);
or
SQL> create type commodity_key as table of varchar2(500);
Use the varray if you know the number of items in the array. Otherwise, use the nested table. -
I want to pass String array to Stored procedure .
ArrayDescriptor claim = ArrayDescriptor.createDescriptor("POOJA.VARCHAR_TBL" , conn);
String test[] = {"an","jk"};
ARRAY a = new ARRAY(claim,conn,test);
cstmt.setArray(noOfParms,a);
It gives class cast exception at ArrayDescriptor .. Dont know why ?
Need an urgent help ...ArrayBinding feature is for bulk operation where a SP or SQL statement executes ArrayBindCount time in one server round trip. Each execution uses the nth element in the parameter (array) and execute the SP or SQL statement.
This is done internally in the database, and not related to the SP or SQL statement at all.
The PL/SQL Associative array support might be the feature that you're looking for.
Please take a look from our Doc on these topics for further information. Also take a look in the ODP.NET dissucssion forum's samples section.
Thanks
Martha -
I built a dll in LV 7. One of the inputs was an array of strings. LV created the following typedef for this input:
typedef struct {
long dimSize;
LStrHandle elt[1];
} TD2;
typedef TD2 **TD2Hdl;
The function prototype generated by LV is:
void __stdcall AddRow(TD1 *errorInNoError, TD2Hdl *TestResult,
LVRefNum *WordTableIn, LVRefNum *WordSelectionIn, TD1 *errorOut);
The question is to call this function, what do I have to pass into the dll from LV? I've tried several ways and it keeps crashing. When I create the dll, it doesn't give me the option to define the input as an array, it just creates the typedef. So when I configured the dll, I chose "Adapt to Type". This didn't work with either "Handle by Value" or "Pointer to Handle". If
I configure the input as an Array, there is no string type listed (uint32 maybe?)
TIA
Bill FHello Bill,
As an example of this type of program, you might want to check out some of the following links:
Creating and Calling LabVIEW DLLs with Various Data Types from Microsoft Visual Basic
Creating and Calling LabVIEW DLLs with Various Data Types from CVI
Creating and Calling LabVIEW DLLs with Various Data Types from Microsoft Visual C++
We also have a few example programs that we are working on that are not yet on our
website. These are example of how to configure a LabVIEW DLL passing string arrays. I attached the ZIP file to this post.
I hope this helps!
Liz F
National Instruments
Attachments:
String2Darray.zip 24 KB
LV_string_array.zip 75 KB -
How to roundup String array values
Hello friends,
I have some problem in my jsp page, if i give the qty value 12345.9876 like this i have problem if i will give like this 12345.99
it work so i want to roundup the values how to round up the string[] saQty=null;
the saQty i want to round up how it's possible
pls any one can help me.................Hello friends,
I have some problem in my jsp page, if i givethe
he qty value 12345.9876 like this i have problemif
i
will give like this 12345.99
it work so i want to roundup the values how toround
up the string[] saQty=null;
the saQty i want to round up how it's possible
pls any one can help me.................i have do today itself pls any one help me....You waited for two minutes?
Just convert the strings to e.g. BigDecimal, then
round them, and convert back to string.
Kaji have tried with this code but i got error that bigdecimal we cannot pass String array so that i asked u.......
BigDecimal gridQty = null;
gridQty = new BigDecimal(arrQty);
gridQty = gridQty.setScale(2,BigDecimal.ROUND_HALF_UP);
arrQty = gridQty.toString();
System.out.println("Ramesh gross :"+gridQty); -
How do I pass an array of structs to a C function using the dll flexible prototype adapter?
What I want to do is pass into a C dll function a variably sized Array of structs of type TPS_Data. My Code compiles but when I run it in TestStand, I get an error -17001; Program Error. "Cannot allocate 0 size buffer Error in parameter 2, 'OpenFrdData'."
I've allocated the Array of structs, and all of the information is there before I call my function, so is it my prototype? Or am I asking too much of the DLL Flexible Prototype Adapter to pass an Array of Structs?
I can pass in a single struct of type TPS_Data and that works, but not an array.
Here's the relevent code:
typedef struct TPS_DATA
char Report_Number[256];
char System_Name[256];
char Open_Date[256];
char UUT_Part_Number[256];
char UUT_Serial_Number[256];
char UUT_Name[256];
char Open_Employee_Name[256];
char Open_Employee_Number[256];
char Close_Employee_Name[256];
char Close_Employee_Number[256];
char Close_Date[256];
} TPS_Data;
typedef struct TPS_DATA_ARRAY
TPS_Data DataRecord;
} TPS_DataArray;
long __declspec(dllexport) __stdcall OpenDialog (CAObjHandle Context, TPS_DataArray *TpsData[], const char *psFaultStr, char *sComments, const int nCount);OK,
I can pass the data to the DLL function, using the following types:
typedef struct StringArrayType
char string[10][256];
} StringArray;
typedef struct MultiStringArrayType
StringArray Record[10];
} MultiStringArray;
void __declspec(dllexport) __stdcall ATP_TestStructPassing(StringArray Strings)
return;
void __declspec(dllexport) __stdcall ATP_TestMultiStructPassing(MultiStringArray *Strings)
return;
But when the MultiStruct function Exits, TestStand reports an Error:
-17501 "Unexpected Operating System Error" Source: 'TSAPI'
There doesn't seem to be a way around this, and once the error occurs, I have to force quit TestStand. I've included the sequence file, and the dll code can be compiled from the fun
ctions shown above.
Any thoughts on how to get around this error would be greatly appreciated.
Attachments:
StructArrayPassing.seq 16 KB -
How do you pass an array of characters using the DLL functions
I have exported C code into my DLL and I want to know how to pass an array of characters using LabVIEW.
Mont;
If you want to pass a string from LabVIEW to your dll, and you do NOT change size of the string, you can use a C String pointer (CStr), which is equivalent to (unsigned) char *.
If you do modify size of the string, pass string as a LabVIEW structure (LStrHandle).
The example "Passing a Variety of Data Types from DLL to LabVIEW" is an excellent starting point. Also make sure you check the manual "Using External Code in LabVIEW".
Regards;
Enrique
www.vartortech.com -
Pass String[] (String Array) type to a parameter in "Edit Action Binding"
Hi
Hope you are doing fine. This is very important to me, kindly help me in this regad.
I have a scenario where I need to pass in a parameter of type String[] that has only one value {"Name"} to a webservice that returns some values.
I've created a WS datacontrol, dragged and dropped the return value on to a jspx, then it asks me to give the input value
How do I pass it to the Parameter in "Edit Action Binding"?
When I say new String[]{"Name"}, it gives me the following error
Cannot create an object of type:[Ljava.lang.String; from type:java.lang.String with value:new String[]{"Name"}
Similarly, I hardcoded this value in a managedBean, added it to requestScope/applicationScope and queried it using #{applicationScope.AppCreationBean.epsName}
But this time, it says, the value is null. I guess the value is not getting initialized properly. But if i hardcode the value in the getter method, I'm again getting the error as above.
Would some one tell me how to pass an array of type String (ie, String[]) with a value "Name" in the "Edit Action Binding" wizard itself?
Regards
RaviKiranHi Frank
Thanks for the reply.
Issue resolved by initializing it in the ManagedBean.
For some reason, when I put it in request/application scopes, it was coming as null, but when I registered the Bean in PageFlowScope, it was working!
Regards
RaviKiran
Maybe you are looking for
-
In R12, can payroll user enter expense report for employees via web-based?
Hi, In R12, can payroll user enter expense report for employees via web-based screen? Previously in 11i, it can be done via the Expense Report forms. Appreciate advise on this. Thanks in advance. Regards, Shiau Chin
-
IPhone vs. Blackberry/Palm OS
I really like the iPhone. I’ve had my phone for 3 weeks now, and it is just so friendly and intuitive to use. The high res screen shows the icon and the text of the button you want. That makes it so easy and fast to launch an application. Beats the B
-
I connect my Ipod Touch to my computer and it shows that it is there and connected everywhere but itunes. I keep getting a message stating Itunes Could not connect to the itunes store. An Unkown error occurred (-3212). please help me!
-
HP LaserJet Printer Network Replacement for AppleTalk
Have found the fix for making the HP LaserJet 2100 TN work on an Ethernet network with Snow Leopard OS. The key was finding the address of the LaserJet on the network. This was done by holding down the two buttons on the top of the printer simultaneo
-
Recovery partition missing on new Mac Mini after bootcamp
Hi folks. I recently installed boot camp then removed it and now I do not have my recovery partition and I cant' find a way to get it back. I have tried the option key at startup along with the option+R and neither allow me to do emergency recovery