conversion from string to byte

hi,
how we convert from string to byte,

typedef unsigned char byte;
string buffer;
crypt_encode(byte *,buff_size,CRYPT_DES,Key);//prototype
crypt_endcode(buffer,buff_size,CRYPT_DES,Key);

error: cannot convert parameter1 from std:string to "byte *"

how we will solve this problem.

regards
suresh
1. Get the char array representation of buffer.
2. Cast away the const.
i want to read data from the file for that i need string buffer.

regards
suresh
There's a member function on std::string that will do step 1. That gives you a const char*. You then need to appy a cast to remove the const.
Topic archived. No new replies allowed.