error C2679: binary '=' : no operator defined which takes a right-hand operand of type
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > (__cdecl *)(void)'
(or there is no acceptable conversion)
If you're calling between C++ DLLs from the same compiler, you can return strings quite happily...the best thing if you're making a C DLL is to get them to supply a buffer and a length, then fill it up a la strncpy().
Watch for the buffer overruns, though!
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You". -- Linus Torvalds
Well you are both too good in C for me because I think you have answer my question with too much hard word because I do not understand what to change to have no error...
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,st
ruct std::char_traits<char>,class std::allocator<char> > (__cdecl *)(void)' (or there is no acceptable conversion)
warning C4550: expression evaluates to a function which is missing an argument list
C++ doesn't have something like in vb unload() or a function who is exectuted when the program close ?
Here is in the dll the code of the password function, the freelibrary didn't solve the problem.
PHP Code:
std::string __declspec( dllexport )PasswordMaker()
{
char cChar; //Contain the character that the user have pressed
std::string sPass; //Contain all character
int iNombreChar = 0; //Number of character that the user have pressed
//Loop until the user press enter
while(true)
{
//Get character one by one
cChar = getch();
//Only if the number that the user put is bigger than 1 you can erase
if (iNombreChar > 0)
{
if( cChar == 8)
{
//Erase the character in the String
sPass = sPass.substr(0,sPass.length() -1);
//Erase the character at the screen
std::cout << (char)(8) << char(32) << char(8);
iNombreChar--;
}//End if
}//End if
//Put stars and not the character
if (cChar != 13 && cChar != 8)
{
sPass += cChar;
std::cout << "*";
iNombreChar ++;
}//End if
//If the user press ENTER than we have done with the password creation
else if (cChar == 13)
break;
}//End for while(true)
return sPass;
}//End PasswordMaker
C++ doesn't have something like in vb unload() or a function who is exectuted when the program close ?
Here is in the dll the code of the password function, the freelibrary didn't solve the problem.
PHP Code:
std::string __declspec( dllexport )PasswordMaker()
{
char cChar; //Contain the character that the user have pressed
std::string sPass; //Contain all character
int iNombreChar = 0; //Number of character that the user have pressed
//Loop until the user press enter
while(true)
{
//Get character one by one
cChar = getch();
//Only if the number that the user put is bigger than 1 you can erase
if (iNombreChar > 0)
{
if( cChar == 8)
{
//Erase the character in the String
sPass = sPass.substr(0,sPass.length() -1);
//Erase the character at the screen
std::cout << (char)(8) << char(32) << char(8);
iNombreChar--;
}//End if
}//End if
//Put stars and not the character
if (cChar != 13 && cChar != 8)
{
sPass += cChar;
std::cout << "*";
iNombreChar ++;
}//End if
//If the user press ENTER than we have done with the password creation
else if (cChar == 13)
break;
}//End for while(true)
return sPass;
}//End PasswordMaker