error C2440: 'type cast' : cannot convert from 'const char * to 'unsigned char'

Status
Not open for further replies.

klun

Junior Member level 2
Joined
May 1, 2015
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
386

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void main(void) {
  unsigned long L = 1, R = 2;
  BLOWFISH_CTX ctx;
 
 
  using namespace std;
 
 string input = "";
 
 cout << "Please enter a valid sentence (with spaces):\n>";
 getline(cin, input);
 cout << "You entered: " << input << endl << endl;
 
 
  Blowfish_Init (&ctx, (unsigned char*)(input.c_str), 7); //line with error
  Blowfish_Encrypt(&ctx, &L, &R);
  printf("%08lX %08lX\n", L, R);
  if (L == 0xDF333FD2L && R == 0x30A71BB4L)
      printf("Test encryption OK.\n");



Can anyone help me with that error?
 
Last edited by a moderator:

string member c_str is a member function, e.g. try it with parameters ()
Code:
Blowfish_Init (&ctx, (unsigned char*)(input.c_str()), 7); //line with error
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…