Sign in to follow this  
lonewolff

Poblems copying a string of text

Recommended Posts

Hi Guys,

I am writing a program that displays entires from an LDAP directory.

But, for the life of me, I can't put the text returned into a simple string variable.
[size="2"][source]ppValue = ldap_get_values(pLdap,pEntry,pAttribute);

iValue = ldap_count_values(ppValue);
if(iValue)
{
std::cout<<ppValue[0]<<"\t";

//std::strcpy(szPath,ppValue[0]); // This wont compile <<<<<<
}[/source]
So, the std::cout displays happily. But I cant work out how to store this into a string (or char) variable.

[b]error C2664: 'strcpy' : cannot convert parameter 1 from 'std::string' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

[/b]Any help would be greatly appreciated. :cool:

[/size]

Share this post


Link to post
Share on other sites
Thanks guys.

I now have this;

[code] iValue = ldap_count_values(ppValue);
if(iValue)
{
std::cout<<ppValue[0]<<"\t";
szPath=ppValue[0];
std::cout<<szPath<<std::endl;
}[/code]

But this produces this error;

[b]error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)
[/b]
[size="2"]

[/size]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this