SysUtilsStrLCopy (C++)

From RAD Studio Code Examples
Jump to: navigation, search


The following example uses an edit control and a button on a form. When the button is clicked, the first X bytes of the edit control are copied into a buffer, where X is a predefined number.

const MAX_BUFFER = 10;


void __fastcall TForm1::Button1Click(TObject *Sender)
  char szBuffer[MAX_BUFFER+1];
  StrLCopy(szBuffer, Edit1->Text.t_str(), MAX_BUFFER);
  Application->MessageBox(WideString(szBuffer).c_bstr(), L"StrLCopy example", MB_OKCANCEL);