Hi,
I am a newbie in C.
I want to concatenate two strings as follows.
char InvNo[15]="12345";
char *InvNoStr;
InvNoStr=strcat("INVOICE NO: ",InvNo);
which returns only 'INVOICE NO:'
can anybody advise?
thanks you,
Thomas
Hi,
I am a newbie in C.
I want to concatenate two strings as follows.
char InvNo[15]="12345";
char *InvNoStr;
InvNoStr=strcat("INVOICE NO: ",InvNo);
which returns only 'INVOICE NO:'
can anybody advise?
thanks you,
Thomas
"INVOICE NO: " is a string literal. You can't append to that. You could instead copy that first to an array, and then strcat the InvNo onto the end of that array.
Quzah.
Hope is the first step on the road to disappointment.
How about this:
Code:ssprintf(InvNoStr,"INVOICE NO:%s",InvNo);
its more like quzah said:
Code:char InvNo[18] = "INVOICE NO: "; strcat(InvNo , "12345");