Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

Please suggest in for appending a string in the code in C

There are two tasks that need to be accomplished

1> We have a variable named acct_usr_id which stores 7 digit code and I need to append string "P" to acct_usr_id in message.c
and store it to a character array str which is declared as char str[10]; in message.c
2> copy str to e_usr_id

and above both steps need to be implemented the the code below    

ptemp = getparam("acct_usr_idn", 0 );
if (ptemp)
{
     strcpy(e_new_acct_grp, "001");
     // code to store value of acct_usr_id and append string "P" to char array str
     strcpy(e_usr_id, str);    
     audmsg("User id in message25 is %s", ptemp);
}
else
strcpy(e_new_acct_grp, "000");

Please let me know
Regards
Ronan
0
ronan_40060
Asked:
ronan_40060
1 Solution
 
Diane258Commented:
Here is the function you need

http://www.cplusplus.com/ref/cstring/strcat.html

ptemp = getparam("acct_usr_idn", 0 );
if (ptemp)
{
     strcpy(e_new_acct_grp, "001");
     // code to store value of acct_usr_id and append string "P" to char array str
     strcpy(e_usr_id, str);    
     audmsg("User id in message25 is %s", ptemp);
// append the two strings
strcat (e_usr_id, ptemp );
// append all into string str
strcpy(str,eusr_id)

}
else
strcpy(e_new_acct_grp, "000");
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now