| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Assigning text in an OCIString
I've tried the sample code of Oracle's documentation. I had to make
small changes, since the initial code does not compile...
Unfortunately, the final code compiles, but does not work. The
OCIString pointer points to a NULL string. Coul you tell me what I'm
doing wrong ????
[code]
OCIString *vstring1 = (OCIString *)0; char c_string[20]; sword status;
strcpy(c_string, "hello world");
ub4 lg = strlen(c_string);
/* Assign a text string to an OCIString */
status = OCIStringAssignText( m_pEnv, m_pErr, (text*) c_string, lg,
&vstring1);
/* Memory for vstring1 is allocated as part of string assignment */
text* ptr = OCIStringPtr( m_pEnv, vstring1 );
[/code]
After the call to OCIStringPtr, ptr == NULL.
NB : m_pEnv & m_pErr are allocated & valid
Regards,
C.
Received on Fri Mar 17 2006 - 09:40:46 CST
![]() |
![]() |