Bryan DeNosky
March 29th, 1999, 06:57 PM
Could someone please tell me the code needed to send out the ascii value of a CString class variable out port 1?
|
Click to See Complete Forum and Search --> : Sending a string out port 1 Bryan DeNosky March 29th, 1999, 06:57 PM Could someone please tell me the code needed to send out the ascii value of a CString class variable out port 1? Srinivas Rao March 30th, 1999, 12:30 AM Include the MS Commnication control to your object.Create the control in one of your classes. Use the memeber function for outputting the string to the any of the COM port. Rajaraman April 13th, 1999, 03:02 AM I am able to send a CString all right. But I want to send an array of BYTES : unsigned char arr[100]; I am able to send this through the Com port using MSComm control. But at the receiving end, I am stuck. The incoming array is available wrapped inside a VARIANT. How to extract my array from within this variant ? Should I use a SafeArray ? I'm not sure how to convert the variant to SafeArray. Please help me with a piece of code, if possible. Thanks. nikku April 15th, 1999, 09:29 PM nikku The return type is a VARIANT. The vt field (VARTYPE) should be equal to 0x2011 and the parray field data is a pointer to a SAFEARRAY that contains the data. To find out how many bytes have been received from the port you could do the following: VARIANT varg; varg = MSCommObj.GetOutput(); if(varg.vt != 0x2011) // don't know if this absolutely correct!!! continue; number of bytes read from COM1 = varg.parray->rgsabound[0].cElements ptr to array of bytes read = varg.parray->pvData Kevin M. Reilly codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |