It's an ODBC function:
SQLConnect (
SQLHDBC ConnectionHandle, /* hdbc */
SQLCHAR *ServerName, /* szDSN */
SQLSMALLINT ServerNameLength, /* cbDSN */
SQLCHAR *UserName, /* szUID */
SQLSMALLINT UserNameLength, /* cbUID */
SQLCHAR *Authentication, /* szAuthStr */
SQLSMALLINT AuthenticationLength);
I'm needing to turn the server name that is a string object
into a char* to cast it to SQLCHAR* and I didn't find any other
function that takes const SQLCHAR* instead of SQLCHAR*. Thanks again ; )
.
On 1/25/07, Pete Robbins <[EMAIL PROTECTED]> wrote:
OK. I have to ask.... what function are you calling that takes a char*? Is
there an equivalent that takes const char*?
Cheers,
On 25/01/07, Adriano Crestani <[EMAIL PROTECTED]> wrote:
>
> I'm trying to use a function that requires a char* not const as a
> paremeter.
> I think strdup will help a lot, thanks ; )
>
> Adriano Crestani
>
> On 1/25/07, Pete Robbins <[EMAIL PROTECTED]> wrote:
> >
> > On 25/01/07, Adriano Crestani <[EMAIL PROTECTED]> wrote:
> > > I'm begginer with C++ and I would like to know the best way to
obtain
> a
> > > char* from a string object, for example:
> > >
> > > string name = "Alice";
> > > char* namePtr = (char*) string; // this is not possible : (
> > >
> > > Obs.: I'm needing a char* and not a const char* pointer
> > >
> > > Thanks.
> > >
> > > Adriano Crestani
> > >
> > >
> >
> > std::string has a .c_str() method to return the const char*
> > const char* namePtr = name.c_str();
> >
> > Why do you need char* and not const char*? You could cast the value to
> > char* but it is const for a good reason... you should not use c
> > functions to manipulate the characters in std:string!
> >
> > You can take a copy of the string using strdup.
> >
> > Cheers,
> >
> > --
> > Pete
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
--
Pete