Converting c code into cpp code

Angus Comber angus at iteloffice.com
Fri Dec 29 12:28:24 UTC 2006


Hello

I have some SNACC c code which I want to convert into cpp code.

Here is the C code:

void testMonitorStart(char *deviceNum)
{
  MonitorStartArgument *args;

  /* Initialize the MonitorStartArgument struct */
  args = Asn1Alloc(sizeof(MonitorStartArgument));
  /* Monitored device */
  args->monitorObject = Asn1Alloc(sizeof(MonitorObject));
  args->monitorObject->choiceId = CSTAOBJECT_DEVICE;
  args->monitorObject->a.device = Asn1Alloc(sizeof(DeviceID));
  args->monitorObject->a.device->choiceId = DEVICEID_DIALINGNUMBER;
  args->monitorObject->a.device->a.dialingNumber =
Asn1Alloc(sizeof(NumberDigits));
  setoctet(args->monitorObject->a.device->a.dialingNumber, deviceNum);

  /* Process APDU (fill, encode and send the APDU) */
  processAPDU((void *) args, MONITORSTARTSID);
}


I have converted to:

void CMainDlg::testMonitorStart(char* deviceNum)
{
 MonitorStartArgument* args;
 /* Initialize the MonitorStartArgument struct */
 /* Monitored device */
 args->monitorObject->choiceId = CSTAObject.deviceCid;
 args->monitorObject->device->choiceId = DeviceID.dialingNumberCid;
 args->monitorObject->device->dialingNumber->assign(deviceNum,
lstrlen(deviceNum)); // myia5string;
 /* Process APDU (fill, encode and send the APDU) */
 processAPDU((void *) args, CSTAServices.monitorStartSID); //
MONITORSTARTSID);
}

Is this correct?

Angus







More information about the dev mailing list