Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top