troubleshooting Question

Questions for win32 dll and data type conversion?????

Avatar of inteq
inteq asked on
System Programming
1 Comment1 Solution333 ViewsLast Modified:
Dear Expert,
I would like to create one DLL which will accept two variables "key" and "random"..
I am using string variable type as shown in below.

__declspec(dllexport) string __cdecl A3A8(string ki, string random)
{
.....
}

Is it correct for accepting two stings in Win32 DLL?

If it is correct, I also want to change my string into char array.
My currrent codes are:
__declspec(dllexport) string __cdecl A3A8(string ki, string random)
{
           string myreturn;
           char s2[32];
           strcpy(s2,(LPCTSTR)ki);
           int i;
         for (i=0; i<16; i++)
        {
            key[i] = (hextoint(s2[2*i])<<4)| hextoint(s2[2*i+1]);
        }
          return myreturn;

}

I ve got the errors:
C:\Program Files\Microsoft Visual Studio\MyProjects\09_01_09\09_01_09.cpp(47) : error C2440: 'type cast' : cannot convert from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

Please help me to change the string into char array..
Thank you in advance . Regards!

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros