C ++ Builder. Hello. Help, what did I do wrong? Here is the button code:

void __fastcall TForm1::Button1Click(TObject *Sender) { Edit1->Text = "Generating..."; Sleep(700); randomize(); a=random(9); b=random(9); c=random(9); d=random(9); e=random(9); f=random(9); g=random(9); h=random(9); i=random(9); j=random(9); k=random(9); activationkey = char(a) + char(b) + char(c) + char(d) + char(e) + char("-OEM") + char(f) + char(g) + char(h) + char(i) + char(j) + char (k); Edit1->Text = activationkey; } 

I will be very grateful.

  • one
    1) use C ++ Builder in 2019 2) copy-paste 3) use not so hot which random key generation - VTT
  • Where did you get the error? Which line of code? What are a , b , c , etc.? What is activationkey ? What is char("-OEM") ??? O_o - AnT

1 answer 1

The C ++ language does not allow pointer casting to integer types if the target integer type is of insufficient size. In your code, such a cast is done in char("-OEM") (assuming that your platform is not exotic).