----- Original Message -----
Sent: Wednesday, June 21, 2000 10:15
AM
Subject: RE:
Thanks Patrick. Now for the tricky one. I have an
external DS which has fields defined in it such as CHAR MSGDTp [40] (The field
is actually named MSGDT# however the interface converts the # to p to
establish a correct C syntax named field). If I want to append some other
string via strcpy then both fields have to be a string (according to the
manual). Does this mean that I have to convert my external DS field into a
string (via a locally define variable, of the same size as the MSGTp field
plus 1 )?by appending a null character? And if so how do I do that? Do I have
to get complicated by finding the first blank in MSGDT ( or the first
non-blank from right to left, plus 1 )and then placing the null (0x00)
value into that character position to turn it into a string?
Mike,
You cannot use str... functions on general char array fields containing
data from external sources, as they never have a 0x00 in the end. The way
is:
char szStr1[6]; // for a zero terminated string of 5
chars
char szResult[46]; // for the result 30+40
strcpy(szStr1, "HELLO") ;
memcpy(szResult, MSGDTp, 40) ;
memcpy(&szResult[40], szStr1, 6) ;
// szResult is a zero-terminated string.