First, there is no point in using the [Q] tag in the subject line when
posting a question. A question mark at the end is a better choice.
Can someone tell me what is different between below case?
strcpy(eventname, "MDCX_RSP");
and
sprintf(eventname, "MDCX_RSP");
They have the same effect, only the return value (which you ignore,
anyway) is different.
However, the execution of the strcpy call is likely to be faster than the
execution of the sprintf call. The former has to compare each copied
character to 0, while the latter has to compare it to both 0 and % and
also check each character whether it is a single byte character of the
first byte of a multibyte character.
To be perfectly safe, regardless of the contents of the copied string,
the sprintf call should be written like this:
sprintf(eventname, "%s", "MDCX_RSP");
but why bother, since strcpy() is the right tool for the job?
Dan